root/widgets/group-box.r

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

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

Line 
1group-box: make rebface [
2        tip:    {
3                USAGE:
4                        group-box "Title" data [field field]
5
6                DESCRIPTION:
7                        A static widget used to group widgets within a bounded container.
8        }
9        size:   -1x-1
10        text:   "Untitled"
11        effect: [draw [pen colors/outline-dark line-width sizes/edge fill-pen none box 0x0 0x0 effects/radius pen colors/page line 0x0 0x0]]
12        font:   make default-font-top [color: colors/outline-dark]
13        para:   make default-para [origin: as-pair sizes/cell * 4 0]
14        feel:   make default-feel [
15                redraw: make function! [face act pos] [
16                        if act = 'show [
17                                all [   ; handle color change
18                                        face/color
19                                        face/effect/draw/fill-pen: face/color
20                                        poke face/effect/draw 12 colors/page
21                                        face/color: none
22                                ]
23                                face/effect/draw/15/x: sizes/cell * 5 + first size-text face
24                        ]
25                ]
26        ]
27        action: make default-action [
28                on-resize: make function! [face] [poke face/effect/draw 9 face/size - 1x1]
29        ]
30        rebind: make function! [] [
31                font/name: effects/font
32                font/size: sizes/font
33                font/color: colors/outline-dark
34                para/origin/x: sizes/cell * 4
35        ]
36        init:   make function! [] [
37                data: layout/only data
38                pane: data/pane
39                foreach face pane [face/offset: face/offset + as-pair 0 sizes/cell * sizes/gap]
40                all [negative? size/x size/x: max 16 + first size-text self data/size/x]
41                all [negative? size/y size/y: sizes/cell * sizes/gap + data/size/y]
42                effect/draw/box/y: effect/draw/14/y: effect/draw/15/y: sizes/cell * 2
43                effect/draw/14/x: sizes/cell * 3
44                data: none
45                action/on-resize self
46        ]
47]
Note: See TracBrowser for help on using the browser.