root/widgets/symbol.r

Revision 112, 2.1 kB (checked in by ashley, 11 months ago)

Added pill.r
Scroller fixes
Major color / theme management changes (in progress)

Line 
1symbol: make rebface [
2        tip:    {
3                USAGE:
4                        symbol data 'start
5                        symbol data 'rewind
6                        symbol data 'left
7                        symbol data 'pause
8                        symbol data 'stop
9                        symbol data 'record
10                        symbol data 'right
11                        symbol data 'forward
12                        symbol data 'end
13                        symbol data 'up
14                        symbol data 'down
15                        symbol -1 "Some text"
16
17                DESCRIPTION:
18                        Basic single-color shapes, such as those found on media players, on an "arrow" type button.
19                        Uses "Webdings" if available, otherwise simple ASCII equivalents.
20        }
21        size:   5x-1
22        text:   ""
23        edge:   default-edge
24        font:   default-font-heading
25        feel:   make default-feel [
26                redraw: make function! [face act pos] [
27                        if act = 'show [
28                                face/color: either face/data [colors/state-light] [colors/theme-light]
29                        ]
30                ]
31                engage: make function! [face act event] [
32                        do select [
33                                time    [all [face/data face/action/on-click face]]
34                                down    [face/data: on]
35                                up              [face/data: off face/action/on-click face]
36                                over    [face/data: on]
37                                away    [face/data: off]
38                        ] act
39                        show face
40                ]
41        ]
42        action: make default-action [
43                on-resize: make function! [face] [
44                        face/font/size: to integer! (min face/size/x face/size/y) * either face/font/style [.6] [.8]
45                        all [odd? face/font/size face/font/size: face/font/size + 1]
46                        all [
47                                not effects/webdings
48                                negative? face/font/space/x
49                                face/font/space/x: face/font/size * -.2
50                        ]
51                ]
52        ]
53        init:   make function! [] [
54                either all [data empty? text] [
55                        font: make font either effects/webdings [[name: "webdings"]] [[space: -1x0 style: 'bold]]
56                        all [negative? size/y size/y: size/x]
57                        text: pick do select [
58                                start   [["9" "|<<"]]
59                                rewind  [["7" "<<"]]
60                                left    [["3" "<"]]
61                                pause   [[";" "| |"]]
62                                stop    [["<" "[ ]"]]
63                                record  [["=" "O"]]
64                                right   [["4" ">"]]
65                                forward [["8" ">>"]]
66                                end             [[":" ">>|"]]
67                                up              [["5" "^^"]]
68                                down    [["6" "v"]]
69                        ] data effects/webdings
70                ][
71                        font: make font [style: 'bold]
72                        all [negative? size/y size/y: sizes/line]
73                        font/size: to integer! size/y * .6
74                        all [negative? size/x size/x: 6 + first size-text self]
75                ]
76                data: off ; redefine data
77                action/on-resize self
78        ]
79]
Note: See TracBrowser for help on using the browser.