Push Button + Image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Push Button + Image

Bruno Brasesco
Hi,

I have a packge "Buttons" for D5 where i can use a Text plus and Image
(both at the same time), but is not working any more for DX6.

Does anything has changed in DX6 in PushButton manipulation ?

Regards Bruno

| package |
package := Package name: 'Buttons'.
package paxVersion: 0;
        basicComment: ''.


package classNames
        add: #FlatTextImageButton;
        add: #IconButton;
        add: #OwnerDrawButton;
        add: #PushTextImageButton;
        yourself.

package binaryGlobalNames: (Set new
        yourself).

package globalAliases: (Set new
        yourself).

package allResourceNames: (Set new
        add: #FlatTextImageButton -> 'Default view';
        add: #IconButton -> 'Default view';
        add: #OwnerDrawButton -> 'Default view';
        add: #PushTextImageButton -> 'Default view';
        yourself).

package setPrerequisites: (IdentitySet new
        add: '..\Object Arts\Dolphin\IDE\Base\Development System';
        add: '..\Object Arts\Dolphin\Base\Dolphin';
        add: '..\Object Arts\Dolphin\MVP\Base\Dolphin MVP Base';
        yourself).

package!

"Class Definitions"!

PushButton subclass: #OwnerDrawButton
        instanceVariableNames: 'buttonState posicion'
        classVariableNames: 'Shadow'
        poolDictionaries: ''
        classInstanceVariableNames: ''!
OwnerDrawButton subclass: #IconButton
        instanceVariableNames: 'imageUp imageDown'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
OwnerDrawButton subclass: #PushTextImageButton
        instanceVariableNames: 'iconSize iconAlignment multiline'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
PushTextImageButton subclass: #FlatTextImageButton
        instanceVariableNames: 'limitColor limitColorDarker'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!

"Global Aliases"!


"Loose Methods"!

"End of package definition"!

"Source Globals"!

"Classes"!

OwnerDrawButton guid: (GUID fromString: '{E1A2D5D2-312D-45C9-B677-B241196A0466}')!
OwnerDrawButton comment: ''!
!OwnerDrawButton categoriesForClass!Unclassified! !
!OwnerDrawButton methodsFor!

background
        self backcolor notNil ifFalse: [^(SystemColor fromId: 15) asRGB].
        ^self backcolor asRGB!

buttonState
        "Private - Answer the value of the receiver's ''estado'' instance variable."

        buttonState notNil ifFalse: [^#RELEASED].
        ^buttonState!

buttonState: anObject
        "Private - Set the value of the receiver's ''estado'' instance variable to the argument, anObject."

        buttonState := anObject!

defaultExtent
        "Private - Answer the default size of the receiver
        to be used when it is created."

        ^##(48 @ 48)!

defaultWindowStyle
        "Private - Answer a default style to use when creating a checkbox."

        ^super defaultWindowStyle bitOr: ##( 11)!

disableView: aCanvas rect: aRectangle
        (1 to: aRectangle width) do:
                        [:x |
                        (1 to: aRectangle height) do:
                                        [:y |
                                        | color |
                                        color := aCanvas pixelAt: x @ y.
                                        (color isKindOf: RGB)
                                                ifTrue:
                                                        [| intensity |
                                                        intensity := ((color red + color green + color blue) / 3) truncated.
                                                        color = self background
                                                                ifFalse:
                                                                        [aCanvas pixelAt: x @ y
                                                                                put: (RGB
                                                                                                red: intensity
                                                                                                green: intensity
                                                                                                blue: intensity)]]]]!

drawBottom: aCanvas color: aColor frame: anInteger
        ""

        aCanvas pen: (Pen withStyle: PS_SOLID width: 1 color: aColor).
        aCanvas brush: (Brush color: aColor).

        "Bottom"
        aCanvas moveTo: (0 + anInteger) @ (self extent y - 1 - anInteger).
        aCanvas lineTo: (self extent x - anInteger) @ (self extent y - 1 - anInteger)!

drawButton: aCanvas rect: aRectangle
        (self isPressed and: [self isInner])
                ifTrue: [self drawButtonPressed: aCanvas]
                ifFalse: [self drawButtonReleased: aCanvas]!

drawButtonPressed: aCanvas
        | color1 color2 color3 |
        color1 := RGB
                                red: self background red - 32
                                green: self background green - 32
                                blue: self background blue - 32.
        color2 := RGB
                                red: self background red - 96
                                green: self background red - 96
                                blue: self background red - 96.
        color3 := RGB
                                red: self background red - 192
                                green: self background green - 192
                                blue: self background blue - 192.
        self
                drawTop: aCanvas
                        color: color1
                        frame: 1;
                drawLeft: aCanvas
                        color: color1
                        frame: 1;
                drawRight: aCanvas
                        color: color1
                        frame: 1;
                drawBottom: aCanvas
                        color: color1
                        frame: 1.
        self
                drawTop: aCanvas
                        color: color2
                        frame: 0;
                drawLeft: aCanvas
                        color: color2
                        frame: 0;
                drawRight: aCanvas
                        color: color1
                        frame: 0;
                drawBottom: aCanvas
                        color: color1
                        frame: 0.
        self hasFocus ifTrue: [self drawFrame: aCanvas color: color3]!

drawButtonReleased: aCanvas
        | margin color1 color2 color3 color4 |
        margin := 0.
        color1 := RGB
                                red: self background red + 32
                                green: self background green + 32
                                blue: self background blue + 32.
        color2 := RGB
                                red: self background red - 32
                                green: self background green - 32
                                blue: self background blue - 32.
        color3 := RGB
                                red: self background red - 96
                                green: self background red - 96
                                blue: self background red - 96.
        color4 := RGB
                                red: self background red - 192
                                green: self background green - 192
                                blue: self background blue - 192.
        self hasFocus
                ifTrue:
                        [self drawFrame: aCanvas color: color4.
                        margin := 1].
        self
                drawLeft: aCanvas
                        color: color1
                        frame: margin;
                drawTop: aCanvas
                        color: color1
                        frame: margin;
                drawRight: aCanvas
                        color: color3
                        frame: margin;
                drawBottom: aCanvas
                        color: color3
                        frame: margin.
        self
                drawRight: aCanvas
                        color: color2
                        frame: margin + 1;
                drawBottom: aCanvas
                        color: color2
                        frame: margin + 1!

drawFrame: aCanvas color: aColor

        self drawFrame: aCanvas color: aColor margin: 0




!

drawFrame: aCanvas color: aColor margin: anInteger

        self drawTop: aCanvas color: aColor frame: anInteger.
        self drawLeft: aCanvas color: aColor frame: anInteger.
        self drawRight: aCanvas color: aColor frame: anInteger.
        self drawBottom: aCanvas color: aColor frame: anInteger.



!

drawItem: hDC bounding: boundingRectangle
        "Draw the receivers current models value onto a canvas."

        | canvas |
        canvas := Canvas withNonOwnedDC: hDC.
        canvas
                save;
                setBkMode: TRANSPARENT;
                font: self parentView actualFont.
        canvas fillRectangle: boundingRectangle brush: (Brush color: self background).
        self drawButton: canvas rect: boundingRectangle.
        canvas restore.
        self update!

drawLeft: aCanvas color: aColor frame: anInteger
        ""

        aCanvas pen: (Pen withStyle: PS_SOLID width: 1 color: aColor).
        aCanvas brush: (Brush color: aColor).

        "Left"
        aCanvas moveTo: (0 + anInteger) @ (0 + anInteger).
        aCanvas lineTo: (0 + anInteger) @ (self extent y - anInteger)!

drawRight: aCanvas color: aColor frame: anInteger
        ""

        aCanvas pen: (Pen withStyle: PS_SOLID width: 1 color: aColor).
        aCanvas brush: (Brush color: aColor).

        "Right"
        aCanvas moveTo: (self extent x - 1 - anInteger) @ (0 + anInteger).
        aCanvas lineTo: (self extent x - 1 - anInteger) @ (self extent y - anInteger)!

drawTop: aCanvas color: aColor frame: anInteger
        ""

        aCanvas pen: (Pen withStyle: PS_SOLID width: 1 color: aColor).
        aCanvas brush: (Brush color: aColor).

        "Top"
        aCanvas moveTo: (0 + anInteger) @ (0 + anInteger).
        aCanvas lineTo: (self extent x - anInteger) @ (0 + anInteger)!

imageManager
        "Answer the imageManager which holds the icons."

        ^IconImageManager current!

initialize
        "Private - Initialize the receiver's instance variables."

        super initialize.
        buttonStyle := 11. "BS_PUSHBUTTON."
        commandDescription := CommandDescription new.
        buttonState := #RELEASED!

isInner

        ^posicion == #IN.
       
!

isPressed
        ^buttonState == #PRESSED!

onKeyPressed: aKeyEvent
        self
                procesarKeyPressed: aKeyEvent;
                invalidate.
        ^super onKeyPressed: aKeyEvent!

onKeyReleased: aKeyEvent
        self
                procesarKeyReleased: aKeyEvent;
                invalidate.
        ^super onKeyReleased: aKeyEvent!

onKillFocus
        "Handler for loss of focus"

        self procesarKillFocus.
        ^super onKillFocus!

onLeftButtonPressed: aMouseEvent
        self procesarLeftButtonPressed.
        ^super onLeftButtonPressed: aMouseEvent!

onLeftButtonReleased: aMouseEvent
        self procesarLeftButtonReleased.
        ^super onLeftButtonReleased: aMouseEvent!

onMouseMoved: aMouseEvent
        "Default handler for a mouse move event.
        Accept the default processing.
        Note: We don't trigger an event here to save churning."
       
        self procesarMouseMoved: aMouseEvent.
        ^super onMouseMoved: aMouseEvent. !

posicion
        "Private - Answer the value of the receiver's ''posicion'' instance variable."

        posicion notNil ifFalse: [ ^#OUT].
        ^posicion!

posicion: anObject
        "Private - Set the value of the receiver's ''posicion'' instance variable to the argument, anObject."

        posicion := anObject!

procesarKeyPressed: aKeyEvent
        (aKeyEvent code = 32 and: [aKeyEvent isAltKeyDown not])
                ifTrue:
                        [self
                                procesarLeftButtonPressed]!

procesarKeyReleased: aKeyEvent
        (aKeyEvent code = 32 and: [aKeyEvent isBeingReleased]) ifTrue: [self procesarLeftButtonReleased]!

procesarKillFocus
        self buttonState: #RELEASED!

procesarLeftButtonPressed
        self buttonState: #PRESSED!

procesarLeftButtonReleased
        self buttonState: #RELEASED!

procesarMouseMoved: aMouseEvent
        | rectangle |
        rectangle := Rectangle origin: 0 @ 0 extent: self extent.
        (rectangle containsPoint: aMouseEvent position) ifTrue: [self posicion: #IN] ifFalse: [self posicion: #OUT]!

wmDrawItem: message wParam: wParam lParam: lParam
        "Private - A part with SbtOwnerRedraw has been asked to redraw
        itself. Oblige this request.
        Answer true."

        | drawItemStruct part |
        drawItemStruct := DRAWITEMSTRUCT fromAddress: lParam.
        self drawItem: (ExternalHandle fromInteger: drawItemStruct hDC) bounding: drawItemStruct rcItem asRectangle.
        ^true! !
!OwnerDrawButton categoriesFor: #background!private! !
!OwnerDrawButton categoriesFor: #buttonState!accessing!private! !
!OwnerDrawButton categoriesFor: #buttonState:!accessing!private! !
!OwnerDrawButton categoriesFor: #defaultExtent!private! !
!OwnerDrawButton categoriesFor: #defaultWindowStyle!private! !
!OwnerDrawButton categoriesFor: #disableView:rect:!private! !
!OwnerDrawButton categoriesFor: #drawBottom:color:frame:!Button Shadow!private! !
!OwnerDrawButton categoriesFor: #drawButton:rect:!public! !
!OwnerDrawButton categoriesFor: #drawButtonPressed:!private! !
!OwnerDrawButton categoriesFor: #drawButtonReleased:!private! !
!OwnerDrawButton categoriesFor: #drawFrame:color:!Button Shadow!private! !
!OwnerDrawButton categoriesFor: #drawFrame:color:margin:!Button Shadow!private! !
!OwnerDrawButton categoriesFor: #drawItem:bounding:!public! !
!OwnerDrawButton categoriesFor: #drawLeft:color:frame:!Button Shadow!private! !
!OwnerDrawButton categoriesFor: #drawRight:color:frame:!Button Shadow!private! !
!OwnerDrawButton categoriesFor: #drawTop:color:frame:!Button Shadow!private! !
!OwnerDrawButton categoriesFor: #imageManager!public! !
!OwnerDrawButton categoriesFor: #initialize!private! !
!OwnerDrawButton categoriesFor: #isInner!public! !
!OwnerDrawButton categoriesFor: #isPressed!event handling!public! !
!OwnerDrawButton categoriesFor: #onKeyPressed:!public! !
!OwnerDrawButton categoriesFor: #onKeyReleased:!public! !
!OwnerDrawButton categoriesFor: #onKillFocus!public! !
!OwnerDrawButton categoriesFor: #onLeftButtonPressed:!event handling!public! !
!OwnerDrawButton categoriesFor: #onLeftButtonReleased:!event handling!public! !
!OwnerDrawButton categoriesFor: #onMouseMoved:!event handling!public! !
!OwnerDrawButton categoriesFor: #posicion!accessing!private! !
!OwnerDrawButton categoriesFor: #posicion:!accessing!private! !
!OwnerDrawButton categoriesFor: #procesarKeyPressed:!public! !
!OwnerDrawButton categoriesFor: #procesarKeyReleased:!public! !
!OwnerDrawButton categoriesFor: #procesarKillFocus!private! !
!OwnerDrawButton categoriesFor: #procesarLeftButtonPressed!event handling!private! !
!OwnerDrawButton categoriesFor: #procesarLeftButtonReleased!event handling!private! !
!OwnerDrawButton categoriesFor: #procesarMouseMoved:!event handling!private! !
!OwnerDrawButton categoriesFor: #wmDrawItem:wParam:lParam:!private! !

!OwnerDrawButton class methodsFor!

shadowSize
       
        Shadow notNil ifFalse: [^3].
        ^Shadow! !
!OwnerDrawButton class categoriesFor: #shadowSize!public! !

IconButton guid: (GUID fromString: '{389AE1C9-3208-421A-ABD6-1E9D67481ADE}')!
IconButton comment: ''!
!IconButton categoriesForClass!Unclassified! !
!IconButton methodsFor!

drawButton: aCanvas rect: aRectangle

        (self isPressed and: [self isInner])
                ifTrue: [ imageDown notNil
                                ifTrue: [ imageDown drawOn: aCanvas at: aRectangle origin extent: (aRectangle width@(aRectangle height)) ]
                                ifFalse: [self drawButtonPressed: aCanvas]]
                ifFalse: [ imageUp notNil ifTrue: [ imageUp drawOn: aCanvas at: aRectangle origin extent: (aRectangle width@(aRectangle height))]
                                ifFalse: [self drawButtonReleased: aCanvas]].
       
!

imageDown
        "Private - Answer the value of the receiver's ''imageDown'' instance variable."

        ^imageDown!

imageDown: anObject
        "Private - Set the value of the receiver's ''imageDown'' instance variable to the argument, anObject."

        imageDown := anObject!

imageUp
        "Private - Answer the value of the receiver's ''imageUp'' instance variable."

        ^imageUp!

imageUp: anObject
        "Private - Set the value of the receiver's ''imageUp'' instance variable to the argument, anObject."

        imageUp := anObject.
        self image: imageUp.! !
!IconButton categoriesFor: #drawButton:rect:!private! !
!IconButton categoriesFor: #imageDown!accessing!private! !
!IconButton categoriesFor: #imageDown:!accessing!private! !
!IconButton categoriesFor: #imageUp!accessing!private! !
!IconButton categoriesFor: #imageUp:!accessing!private! !

PushTextImageButton guid: (GUID fromString: '{13673742-64B2-4EBD-A74A-54D7C6962B41}')!
PushTextImageButton comment: ''!
!PushTextImageButton categoriesForClass!Unclassified! !
!PushTextImageButton methodsFor!

alignRect: aCanvas rect: aRectangle

        (self iconAlignment == #bottom) ifTrue: [^Rectangle origin: (aRectangle origin) corner: (aRectangle corner - (0@(self iconSize y)))].
        (self iconAlignment == #left) ifTrue: [^Rectangle origin: (aRectangle origin + ((self iconSize x)@0)) corner: (aRectangle corner)].
        (self iconAlignment == #right) ifTrue: [^Rectangle origin: (aRectangle origin) corner: (aRectangle corner  - ((self iconSize x)@0))].
        (self iconAlignment == #top) ifTrue: [^Rectangle origin: (aRectangle origin + (0@(self iconSize y))) corner: (aRectangle corner)].




!

centerIconAt: aRectangle

        | iconRect center |

        iconRect := Rectangle origin: 0@0 extent: self iconSize.
        (self iconAlignment == #bottom) ifTrue: [center := (aRectangle width // 2)@(aRectangle height - self class shadowSize - (self iconSize y // 2))].
        (self iconAlignment == #left) ifTrue: [center := (self class shadowSize + (self iconSize x// 2))@(aRectangle height // 2)].
        (self iconAlignment == #right) ifTrue: [center := (aRectangle width - self class shadowSize - (self iconSize x // 2))@(aRectangle height // 2)].
        (self iconAlignment == #top) ifTrue: [center := (aRectangle width // 2)@(self class shadowSize + (self iconSize y // 2))].

        ^(iconRect center: center) origin


       
!

drawButton: aCanvas rect: aRectangle

        super drawButton: aCanvas rect: aRectangle.
        self paintButton: aCanvas rect: aRectangle.


!

drawIcon: aCanvas in: aRectangle
        self isEnabled
                ifTrue: [image drawOn: aCanvas at: (self centerIconAt: aRectangle) extent: self iconSize]
                ifFalse: [image drawDisabledOn: aCanvas at: (self centerIconAt: aRectangle) extent: self iconSize]!

iconAlignment
        "Private - Answer the value of the receiver's ''iconAlignment'' instance variable."

        iconAlignment notNil ifFalse: [^#left].
        ^iconAlignment!

iconAlignment: anObject
        "Private - Set the value of the receiver's ''iconAlignment'' instance variable to the argument, anObject."

        iconAlignment := anObject.
        self invalidate.!

iconSize
        "Private - Answer the value of the receiver's ''size'' instance variable."

        iconSize notNil ifFalse: [^32@32].
        ^iconSize!

iconSize: anObject
        "Private - Set the value of the receiver's ''iconSize'' instance variable to the argument, anObject."

        iconSize := anObject.
        self invalidate!

initialize
        "Private - Initialize the receiver's instance variables."

        super initialize.
        iconSize := 32@32.!

multiline
        "Private - Answer the value of the receiver's ''multiline'' instance variable."

        multiline notNil ifFalse: [^false].
        ^multiline!

multiline: anObject
        "Private - Set the value of the receiver's ''multiline'' instance variable to the argument, anObject."

        multiline := anObject.
        self invalidate!

paintButton: aCanvas rect: aRectangle
        | rect |
        rect := Rectangle origin: aRectangle origin + self class shadowSize corner: aRectangle extent - self class shadowSize.
        image notNil
                ifTrue:
                        [self drawIcon: aCanvas in: aRectangle.
                        rect := self alignRect: aCanvas rect: rect].
        self text notNil ifTrue: [self writeText: aCanvas in: rect]!

shadow: aCanvas rect: aRectangle
        (1 to: aRectangle width) do:
                        [:x |
                        (1 to: aRectangle height) do:
                                        [:y |
                                        | color |
                                        color := aCanvas pixelAt: x @ y.
                                        (color isKindOf: RGB)
                                                ifTrue:
                                                        [color red: color red - 32 green: color green - 32 blue: color blue - 32.
                                                        aCanvas pixelAt: x @ y put: color]]]!

textFlags
        self multiline ifTrue: [^##(DT_VCENTER | DT_CENTER)].
        ^##(DT_SINGLELINE | DT_VCENTER | DT_CENTER)!

writeText: aCanvas in: aRect
        self isEnabled
                ifTrue:
                        [aCanvas setTextColor: (SystemColor fromId: COLOR_BTNTEXT).
                        aCanvas formatText: self text in: aRect flags: self textFlags]
                ifFalse:
                        [aCanvas setTextColor: (SystemColor fromId: COLOR_3DHIGHLIGHT).
                        aCanvas formatText: self text in: aRect flags: self textFlags.
                        aCanvas setTextColor: (SystemColor fromId: COLOR_3DSHADOW).
                        aCanvas formatText: self text in: aRect flags: self textFlags]! !
!PushTextImageButton categoriesFor: #alignRect:rect:!private! !
!PushTextImageButton categoriesFor: #centerIconAt:!private! !
!PushTextImageButton categoriesFor: #drawButton:rect:!private! !
!PushTextImageButton categoriesFor: #drawIcon:in:!private! !
!PushTextImageButton categoriesFor: #iconAlignment!accessing!private! !
!PushTextImageButton categoriesFor: #iconAlignment:!accessing!private! !
!PushTextImageButton categoriesFor: #iconSize!accessing!private! !
!PushTextImageButton categoriesFor: #iconSize:!accessing!private! !
!PushTextImageButton categoriesFor: #initialize!private! !
!PushTextImageButton categoriesFor: #multiline!accessing!private! !
!PushTextImageButton categoriesFor: #multiline:!accessing!private! !
!PushTextImageButton categoriesFor: #paintButton:rect:!private! !
!PushTextImageButton categoriesFor: #shadow:rect:!private! !
!PushTextImageButton categoriesFor: #textFlags!private! !
!PushTextImageButton categoriesFor: #writeText:in:!private! !

!PushTextImageButton class methodsFor!

alignOptions

        ^#(bottom left right top) asSortedCollection!

publishedAspectsOfInstances
        "Answer a Set of the aspects published by  instances of the receiver"

        ^super publishedAspectsOfInstances
                add: (Aspect choice: #iconAlignment from: self alignOptions);
                add: (Aspect name: #iconSize);
                add: (Aspect boolean: #multiline);
                yourself! !
!PushTextImageButton class categoriesFor: #alignOptions!public! !
!PushTextImageButton class categoriesFor: #publishedAspectsOfInstances!public! !

FlatTextImageButton guid: (GUID fromString: '{C91D9540-676B-4061-96E1-757587735381}')!
FlatTextImageButton comment: ''!
!FlatTextImageButton categoriesForClass!Unclassified! !
!FlatTextImageButton methodsFor!

defaultLimitColor

        ^RGB red: 255 green: 224 blue: 142!

defaultLimitColorDarker
       
        ^RGB red: 247 green: 148 blue: 29!

drawButton: aCanvas rect: aRectangle
        self isInner
                ifTrue: [self isPressed ifTrue: [self drawButtonPressed: aCanvas] ifFalse: [self drawButtonReleased: aCanvas]]
                ifFalse: [self drawButtonReleased2: aCanvas].
        super paintButton: aCanvas rect: aRectangle!

drawButtonPressed: aCanvas
        | shadow bright |
        shadow := RGB
                                red: self background red + 32
                                green: self background green + 32
                                blue: self background blue + 32.
        bright := RGB
                                red: self background red - 96
                                green: self background red - 96
                                blue: self background red - 96.
        self
                drawTop: aCanvas
                        color: bright
                        frame: 0;
                drawLeft: aCanvas
                        color: bright
                        frame: 0;
                drawRight: aCanvas
                        color: shadow
                        frame: 0;
                drawBottom: aCanvas
                        color: shadow
                        frame: 0!

drawButtonReleased: aCanvas

        self
                drawTop: aCanvas color: self limitColor frame: 0;
                drawLeft: aCanvas color: self limitColor frame: 0;
                drawRight: aCanvas color: self limitColorDarker frame: 0;
                drawBottom: aCanvas color: self limitColorDarker frame: 0!

drawButtonReleased2: aCanvas
        | colorClaro colorOscuro colorFocus frame |
        colorClaro := RGB
                                red: self background red + 32
                                green: self background red + 32
                                blue: self background red + 32.
        colorOscuro := RGB
                                red: self background red - 96
                                green: self background green - 96
                                blue: self background blue - 96.
        colorFocus := RGB
                                red: 0
                                green: 118
                                blue: 163.
        frame := 0.
        self hasFocus
                ifTrue:
                        [self drawFrame: aCanvas color: colorFocus.
                        frame := 1].
        self
                drawTop: aCanvas
                        color: colorClaro
                        frame: frame;
                drawLeft: aCanvas
                        color: colorClaro
                        frame: frame;
                drawRight: aCanvas
                        color: colorOscuro
                        frame: frame;
                drawBottom: aCanvas
                        color: colorOscuro
                        frame: frame!

isInner
        self isEnabled ifFalse: [self setOutside].
        ^super isInner or: [self posicion == #KEY]!

limitColor

        limitColor isNil ifTrue:[limitColor := self defaultLimitColor].
        ^limitColor!

limitColor: anObject
        limitColor := anObject!

limitColorDarker

        limitColorDarker isNil ifTrue:[limitColorDarker := self defaultLimitColorDarker].
        ^limitColorDarker!

limitColorDarker: anObject
        limitColorDarker := anObject!

onActionPerformed
        super onActionPerformed.
        self setOutside!

procesarKeyPressed: aKeyEvent
        super procesarKeyPressed: aKeyEvent.
        self setKeyPressed!

procesarKeyReleased: aKeyEvent
        super procesarKeyPressed: aKeyEvent.
        self setOutside!

procesarLeftButtonPressed
        self buttonState == #PRESSED
                ifFalse:
                        [self
                                buttonState: #PRESSED;
                                invalidate]!

procesarLeftButtonReleased
        self
                buttonState: #RELEASED;
                invalidate!

procesarMouseMoved: aMouseEvent
       
        | rectangle |
       
        rectangle := Rectangle origin: 0@0 extent: self extent.
        (rectangle containsPoint: aMouseEvent position)
                ifTrue: [ self isPressed ifFalse: [self setCapture].
                                self setInside]
                ifFalse:[ self isPressed ifFalse: [self releaseCapture].
                                self setOutside].
!

releaseCapture
        self class releaseCapture!

setInside
        (self posicion == #IN or: [self posicion == #KEY])
                ifFalse:
                        [self
                                posicion: #IN;
                                invalidate]!

setKeyPressed
        self posicion == #KEY
                ifFalse:
                        [self
                                posicion: #KEY;
                                invalidate]!

setOutside
        (self posicion == #OUT or: [self posicion == #KEY and: [self isEnabled]])
                ifFalse:
                        [self
                                posicion: #OUT;
                                invalidate]! !
!FlatTextImageButton categoriesFor: #defaultLimitColor!private! !
!FlatTextImageButton categoriesFor: #defaultLimitColorDarker!private! !
!FlatTextImageButton categoriesFor: #drawButton:rect:!public! !
!FlatTextImageButton categoriesFor: #drawButtonPressed:!private! !
!FlatTextImageButton categoriesFor: #drawButtonReleased:!private! !
!FlatTextImageButton categoriesFor: #drawButtonReleased2:!private! !
!FlatTextImageButton categoriesFor: #isInner!public! !
!FlatTextImageButton categoriesFor: #limitColor!accessing!private! !
!FlatTextImageButton categoriesFor: #limitColor:!accessing!private! !
!FlatTextImageButton categoriesFor: #limitColorDarker!accessing!private! !
!FlatTextImageButton categoriesFor: #limitColorDarker:!accessing!private! !
!FlatTextImageButton categoriesFor: #onActionPerformed!public! !
!FlatTextImageButton categoriesFor: #procesarKeyPressed:!event handling!private! !
!FlatTextImageButton categoriesFor: #procesarKeyReleased:!event handling!private! !
!FlatTextImageButton categoriesFor: #procesarLeftButtonPressed!event handling!private! !
!FlatTextImageButton categoriesFor: #procesarLeftButtonReleased!event handling!private! !
!FlatTextImageButton categoriesFor: #procesarMouseMoved:!event handling!private! !
!FlatTextImageButton categoriesFor: #releaseCapture!event handling!private! !
!FlatTextImageButton categoriesFor: #setInside!event handling!private! !
!FlatTextImageButton categoriesFor: #setKeyPressed!event handling!private! !
!FlatTextImageButton categoriesFor: #setOutside!event handling!private! !

"Binary Globals"!

"Resources"!

(ResourceIdentifier class: FlatTextImageButton name: 'Default view') assign: (Object fromBinaryStoreBytes:
(ByteArray fromBase64String: 'IVNUQiAxIEYCDAABAAAAVmlld1Jlc291cmNlAAAAAA4BJABTVEJSZXNvdXJjZVNUQkJ5dGVBcnJh
eUFjY2Vzc29yUHJveHkAAAAAcgAAAEICAAAhU1RCIDEgTggMAAoAAABTVEJWaWV3UHJveHkAAAAA
mgAAAAAAAABSAAAADwAAAFdhbGljeGUgV2lkZ2V0c1IAAAATAAAARmxhdFRleHRJbWFnZUJ1dHRv
bmIAAAAWAAAAAAAAAAAAAABiAAAAAgAAAIIAAAAEAAAACyABRAEAAACgAQAAAAAAAAAAAAAAAAAA
BwAAAAAAAAAAAAAAAAAAAKABAAAAAAAAggAAAAgAAAA1A///AAAAAEYFEgAEAAAAQ29tbWFuZERl
c2NyaXB0aW9uAAAAALoAAAAAAAAAUgAAAAkAAABub0NvbW1hbmQAAAAAAQAAAAEAAAAAAAAAAAAA
ABcAAAC6AAAAAAAAAFIAAAAIAAAAUkVMRUFTRUQGAgUAUG9pbnQAAAAAQQAAAEEAAAAAAAAAAAAA
AAAAAAAGAQ8ATWVzc2FnZVNlcXVlbmNlAAAAAMoAAAAAAAAA0AAAAGIAAAABAAAABgMLAE1lc3Nh
Z2VTZW5kAAAAALoAAAAAAAAAUgAAABAAAABjcmVhdGVBdDpleHRlbnQ6YgAAAAIAAACCAgAAAAAA
AAsAAAALAAAAggIAAAAAAAC/AAAARwAAAKABAAAGAQ8AV0lORE9XUExBQ0VNRU5UAAAAAHIAAAAs
AAAALAAAAAAAAAAAAAAA/////////////////////wUAAAAFAAAAZAAAACgAAADKAAAAAAAAANAA
AABiAAAAAAAAAIICAAAAAAAAwQAAAMEAAAAAAAAAEwAAAEYFBAADAAAASWNvbgAAAAAAAAAAEAAA
AA4CEQBTVEJTaW5nbGV0b25Qcm94eQAAAACaAAAAAAAAAFIAAAAHAAAARG9scGhpblIAAAAYAAAA
SW1hZ2VSZWxhdGl2ZUZpbGVMb2NhdG9yugAAAAAAAABSAAAABwAAAGN1cnJlbnRSAAAADgAAAFB1
c2hCdXR0b24uaWNvDgIfAFNUQkV4dGVybmFsUmVzb3VyY2VMaWJyYXJ5UHJveHkAAAAAUgAAABAA
AABkb2xwaGluZHIwMDUuZGxsAAAAAA=='))!

(ResourceIdentifier class: IconButton name: 'Default view') assign: (Object fromBinaryStoreBytes:
(ByteArray fromBase64String: 'IVNUQiAxIEYCDAABAAAAVmlld1Jlc291cmNlAAAAAA4BJABTVEJSZXNvdXJjZVNUQkJ5dGVBcnJh
eUFjY2Vzc29yUHJveHkAAAAAcgAAAOsDAAAhU1RCIDAgTggMAAoAAABTVEJWaWV3UHJveHkAAAAA
TgINAAEAAABTVEJDbGFzc1Byb3h5AAAAADYABgBTdHJpbmcOAAAAUGFxdWV0ZXM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AAChAAAAYAAAAAYBDwBXSU5ET1dQ
TEFDRU1FTlQAAAAANgAJAEJ5dGVBcnJheSwAAAAsAAAAAAAAAAAAAAD/////////////////////
BQAAAAUAAABVAAAAVQAAAKoCAAAAAAAAwAIAAMIAAAAAAAAAQgMAAAAAAADBAAAAwQAAAAAAAAAT
AAAARgUEAAMAAABJY29uAAAAAAAAAAAQAAAADgIRAFNUQlNpbmdsZXRvblByb3h5AAAAAJoAAAAA
AAAAUgAAAAcAAABEb2xwaGluUgAAABgAAABJbWFnZVJlbGF0aXZlRmlsZUxvY2F0b3K6AAAAAAAA
AFIAAAAHAAAAY3VycmVudFIAAAAOAAAAUHVzaEJ1dHRvbi5pY28OAh8AU1RCRXh0ZXJuYWxSZXNv
dXJjZUxpYnJhcnlQcm94eQAAAABSAAAAEAAAAGRvbHBoaW5kcjAwNS5kbGwAAAAA'))!

(ResourceIdentifier class: OwnerDrawButton name: 'Default view') assign: (Object fromBinaryStoreBytes:
(ByteArray fromBase64String: 'IVNUQiAxIEYCDAABAAAAVmlld1Jlc291cmNlAAAAAA4BJABTVEJSZXNvdXJjZVNUQkJ5dGVBcnJh
eUFjY2Vzc29yUHJveHkAAAAAcgAAAH4CAAAhU1RCIDAgTggMAAoAAABTVEJWaWV3UHJveHkAAAAA
TgINAAEAAABTVEJDbGFzc1Byb3h5AAAAADYABgBTdHJpbmcOAAAAUGFxdWV0ZXMgLSBBQkySAAAA
DwAAAE93bmVyRHJhd0J1dHRvbiYABQBBcnJheREAAAAAAAAAAAAAAMIAAAACAAAANgAMAExhcmdl
SW50ZWdlcgQAAAALIAFEAQAAAGAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AADyAAAABAAAACL00ndGBBIAAgAAAENvbW1hbmREZXNjcmlwdGlvbgAAAAAOAQ4AU1RCU3ltYm9s
UHJveHkAAAAAkgAAAAkAAABub0NvbW1hbmQAAAAAAQAAAAAAAAAAAAAAAQAAAAYBDwBNZXNzYWdl
U2VxdWVuY2UAAAAADgISAFNUQkNvbGxlY3Rpb25Qcm94eQAAAAB6AAAAAAAAAJIAAAAHAAAARG9s
cGhpbpIAAAARAAAAT3JkZXJlZENvbGxlY3Rpb27CAAAAAQAAAAYDCwBNZXNzYWdlU2VuZAAAAABK
AQAAAAAAAJIAAAAQAAAAY3JlYXRlQXQ6ZXh0ZW50OsIAAAACAAAABgIFAFBvaW50AAAAAAsAAAAL
AAAAQgIAAAAAAABlAAAAZQAAAGAAAAAGAQ8AV0lORE9XUExBQ0VNRU5UAAAAADYACQBCeXRlQXJy
YXksAAAALAAAAAAAAAAAAAAA/////////////////////wUAAAAFAAAANwAAADcAAACaAQAAAAAA
ALABAADCAAAAAAAAAEICAAAAAAAAwQAAAMEAAAAAAAAAEwAAAEYFBAADAAAASWNvbgAAAAAAAAAA
EAAAAA4CEQBTVEJTaW5nbGV0b25Qcm94eQAAAACaAAAAAAAAAFIAAAAHAAAARG9scGhpblIAAAAY
AAAASW1hZ2VSZWxhdGl2ZUZpbGVMb2NhdG9yugAAAAAAAABSAAAABwAAAGN1cnJlbnRSAAAADgAA
AFB1c2hCdXR0b24uaWNvDgIfAFNUQkV4dGVybmFsUmVzb3VyY2VMaWJyYXJ5UHJveHkAAAAAUgAA
ABAAAABkb2xwaGluZHIwMDUuZGxsAAAAAA=='))!

(ResourceIdentifier class: PushTextImageButton name: 'Default view') assign: (Object fromBinaryStoreBytes:
(ByteArray fromBase64String: 'IVNUQiAxIEYCDAABAAAAVmlld1Jlc291cmNlAAAAAA4BJABTVEJSZXNvdXJjZVNUQkJ5dGVBcnJh
eUFjY2Vzc29yUHJveHkAAAAAcgAAAG8CAAAhU1RCIDAgTggMAAoAAABTVEJWaWV3UHJveHkAAAAA
TgINAAEAAABTVEJDbGFzc1Byb3h5AAAAADYABgBTdHJpbmcDAAAAbmlskgAAABMAAABQdXNoVGV4
dEltYWdlQnV0dG9uJgAFAEFycmF5EQAAAAAAAAAAAAAAwgAAAAIAAAAXQA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