|
Revision 112, 1.2 kB
(checked in by ashley, 9 months ago)
|
|
Added pill.r
Scroller fixes
Major color / theme management changes (in progress)
|
| Line | |
|---|
| 1 | button: make pill [
|
|---|
| 2 | tip: {
|
|---|
| 3 | USAGE:
|
|---|
| 4 | button "Hello"
|
|---|
| 5 | button -1 "Go!"
|
|---|
| 6 | button "Click me!" [print "click"]
|
|---|
| 7 |
|
|---|
| 8 | DESCRIPTION:
|
|---|
| 9 | Performs action when clicked.
|
|---|
| 10 |
|
|---|
| 11 | OPTIONS:
|
|---|
| 12 | 'info specifies read-only
|
|---|
| 13 | }
|
|---|
| 14 | size: 15x5
|
|---|
| 15 | text: ""
|
|---|
| 16 | color: colors/theme-dark
|
|---|
| 17 | font: make default-font-heading [size: sizes/font - 2]
|
|---|
| 18 | feel: make feel [
|
|---|
| 19 | over: make function! [face act pos] [
|
|---|
| 20 | set-color face either all [act not find face/options 'info] [colors/theme-light] [colors/theme-dark]
|
|---|
| 21 | ]
|
|---|
| 22 | engage: make function! [face act event /local f] [
|
|---|
| 23 | unless find face/options 'info [
|
|---|
| 24 | do select [
|
|---|
| 25 | down [set-color face colors/theme-light]
|
|---|
| 26 | alt-down [set-color face colors/theme-light]
|
|---|
| 27 | up [set-color face colors/theme-dark face/action/on-click face]
|
|---|
| 28 | alt-up [set-color face colors/theme-dark face/action/on-alt-click face]
|
|---|
| 29 | away [set-color face colors/theme-dark]
|
|---|
| 30 | ] act
|
|---|
| 31 | ]
|
|---|
| 32 | ]
|
|---|
| 33 | ]
|
|---|
| 34 | rebind: make function! [] [
|
|---|
| 35 | color: colors/theme-dark
|
|---|
| 36 | font/size: sizes/font - 2
|
|---|
| 37 | ]
|
|---|
| 38 | init: make function! [] [
|
|---|
| 39 | all [negative? size/x size/x: 10000 size/x: 8 + first size-text self]
|
|---|
| 40 | all [find options 'info color = colors/theme-dark color: colors/outline-light]
|
|---|
| 41 | action/on-resize self
|
|---|
| 42 | ]
|
|---|
| 43 | ] |
|---|