| 1 | check: make rebface [
|
|---|
| 2 | tip: {
|
|---|
| 3 | USAGE:
|
|---|
| 4 | check "Option"
|
|---|
| 5 | check "Option" data true
|
|---|
| 6 | check "Option" data false
|
|---|
| 7 |
|
|---|
| 8 | DESCRIPTION:
|
|---|
| 9 | Tristate check-box with a green tick for Yes, a red cross for No, and empty being Unknown.
|
|---|
| 10 | Left and right mouse clicks alternate between Yes/No and Unknown respectively.
|
|---|
| 11 |
|
|---|
| 12 | OPTIONS:
|
|---|
| 13 | 'info specifies read-only
|
|---|
| 14 | 'bistate disables right-click state
|
|---|
| 15 | }
|
|---|
| 16 | size: -1x5
|
|---|
| 17 | text: ""
|
|---|
| 18 | effect: [draw [pen colors/outline-light fill-pen colors/page box 0x0 0x0]]
|
|---|
| 19 | font: default-font
|
|---|
| 20 | para: default-para-indented
|
|---|
| 21 | feel: make default-feel [
|
|---|
| 22 | p1: as-pair 2 sizes/cell + 2
|
|---|
| 23 | p2: -4x-4 + p1 + as-pair sizes/cell * 3 sizes/cell * 3
|
|---|
| 24 | redraw: make function! [face act pos] [
|
|---|
| 25 | all [
|
|---|
| 26 | act = 'show
|
|---|
| 27 | clear skip face/effect/draw 7
|
|---|
| 28 | unless none? face/data [
|
|---|
| 29 | insert tail face/effect/draw reduce either face/data [
|
|---|
| 30 | ['pen colors/state-dark 'line-width sizes/cell / 3 'line as-pair 2 sizes/cell * 3 as-pair sizes/cell * 1.5 p2/y as-pair p2/x p1/y]
|
|---|
| 31 | ][
|
|---|
| 32 | ['pen colors/state-dark 'line-width sizes/cell / 3 'line p1 p2 'line as-pair p2/x p1/y as-pair p1/x p2/y]
|
|---|
| 33 | ]
|
|---|
| 34 | ]
|
|---|
| 35 | ]
|
|---|
| 36 | ]
|
|---|
| 37 | over: make function! [face act pos] [
|
|---|
| 38 | face/effect/draw/pen: either act [colors/state-dark] [colors/outline-light]
|
|---|
| 39 | show face
|
|---|
| 40 | ]
|
|---|
| 41 | engage: make function! [face act event] [
|
|---|
| 42 | do select [
|
|---|
| 43 | down [face/data: either none? face/data [true] [none] face/action/on-click face]
|
|---|
| 44 | alt-down [
|
|---|
| 45 | unless find face/options 'bistate [
|
|---|
| 46 | face/data: either none? face/data [false] [none] face/action/on-click face
|
|---|
| 47 | ]
|
|---|
| 48 | ]
|
|---|
| 49 | away [face/feel/over face false 0x0]
|
|---|
| 50 | ] act
|
|---|
| 51 | ]
|
|---|
| 52 | ]
|
|---|
| 53 | rebind: make function! [] [
|
|---|
| 54 | feel/p1: as-pair 2 sizes/cell + 2
|
|---|
| 55 | feel/p2: -4x-4 + feel/p1 + as-pair sizes/cell * 3 sizes/cell * 3
|
|---|
| 56 | ]
|
|---|
| 57 | init: make function! [] [
|
|---|
| 58 | all [negative? size/x size/x: 10000 size/x: 4 + para/origin/x + first size-text self]
|
|---|
| 59 | effect/draw/6/y: sizes/cell
|
|---|
| 60 | effect/draw/7: as-pair sizes/cell * 3 sizes/cell * 4
|
|---|
| 61 | ; info option
|
|---|
| 62 | if find options 'info [
|
|---|
| 63 | feel/redraw self 'show none
|
|---|
| 64 | effect/draw/4: colors/outline-light
|
|---|
| 65 | feel: make default-feel []
|
|---|
| 66 | ]
|
|---|
| 67 | ]
|
|---|
| 68 | ] |
|---|