REBOL [
    Title: "Big Button"
    Date: 14-Jan-2004
]

ctx-big-button: context [
    svvi: svv/image-stock
    big-button: load-image http://www.ross-gill.com/r/big-button.png
    images: reduce [
        'button          copy/part big-button 38x38
        'button-down     copy/part skip big-button 0x38  38x38
        'button-hover    copy/part skip big-button 0x76  38x38
        'button-enter    copy/part skip big-button 0x114 38x38
    ]
    foreach [style image] images [change next find svvi style image]
    stylize/master [
        BTN: FACE -1x38 with [ ; version 0.1.2 (BIG)
            color: image: none edge: none effects: none
            font: [color: black colors: none style: none size: 18 shadow: none align: 'center valign: 'middle offset: 14x0]
            saved-area: true
    
            ; 'look supercedes 'images, 'effects, 'colors, 'texts, etc. Provides
            ; action-based face manipulation in tandem with the feel/display function.
            look: reduce [
                'default load-stock 'button
                'down load-stock 'button-down
                'hover load-stock 'button-hover
            ]
    
            feel: make svvf/button [
                hover?: off  ; none turns hover off altogether
                over: func [face over? offset][
                    if hover? <> none [hover?: either over? [on][off] show face hover?: off]
                ]
                redraw: func [face act pos /local state] [
                    display face either face/state ['down][either hover? ['hover]['default]]
                ]
                ; Function used to manipulate face
                display: func [face action][
                    face/image: any [select face/look action face/image]
                ]
            ]
            colors: color: none
    
            init: [
                if size/x = -1 [
                    either text [
                        size/x: 1000
                        state: size-text self
                        size/x: either state [state/x + font/offset/x][50]
                        state: none
                    ][size/x: 50]
                ]
                effect: join [extend anti-alias] either effect [effect][make block! 10]
                if color [append effect reduce ['colorize color]]
                color: none
            ]
        ]
    
        BTN-ENTER: BTN "Enter" with [look/default: load-stock 'button-enter]
    ]
]