REBOL [
title: "BTN Style"
author: "Christopher Ross-Gill"
file: %btn-style.r
comments: "Click here for Old Version"
]
stylize/master [
BTN: FACE -1x22 with [ ; version 0.1.2
color: image: none edge: none effects: none
font: [color: black colors: none style: none size: 11 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]
BTN-CANCEL: BTN "Cancel" with [look/default: load-stock 'button-cancel]
BTN-HELP: BTN bold "?" 22x22 with [keycode: 'f1] [notify "Help is not available."]
]