root/widgets/tool-bar.r

Revision 112, 1.4 kB (checked in by ashley, 9 months ago)

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

Line 
1tool-bar: make rebface [
2        tip:    {
3                USAGE:
4                        tool-bar silver data ["Open" %images/document-open.png [request-file] pad 2 none "Save" %images/document-save.png []]
5
6                DESCRIPTION:
7                        An iconic toolbar. Height is set to 30 pixels.
8                        [pad n none] sequence works as per 'pad in the display function.
9        }
10        size:   100x-1
11        pane:   []
12        color:  colors/outline-light
13        rebind: make function! [] [color: colors/outline-light]
14        init:   make function! [/local icon-offset] [
15                size/y: 30
16                icon-offset: 2x2
17                foreach [txt icon spec] data [
18                        either string? txt [
19                                insert tail pane make subface [
20                                        ;type:  'icon
21                                        offset: icon-offset
22                                        size:   22x22
23                                        text:   ""
24                                        image:  any [
25                                                if word? icon [get icon]
26                                                if file? icon [load icon]
27                                                icon
28                                        ]
29                                        tip:    txt
30                                        feel: make default-feel [
31                                                over: make function! [face act pos] [
32                                                        face/color: either act [colors/state-light] [none]
33                                                        show face
34                                                ]
35                                                engage: make function! [face act event] [
36                                                        do select [
37                                                                down    [face/action face]
38                                                                up              [face/feel/over face false none]
39                                                                away    [face/feel/over face false none]
40                                                        ] act
41                                                ]
42                                        ]
43                                        action: make function! [face /local var] spec
44                                ]
45                                icon-offset: icon-offset + 24x0
46                        ][
47                                icon-offset/x: icon * sizes/cell + icon-offset/x        ; pad n none
48                        ]
49                ]
50                data: none
51        ]
52]
Note: See TracBrowser for help on using the browser.