root/widgets/title-group.r

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

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

Line 
1title-group: make rebface [
2        tip:    {
3                USAGE:
4                        title-group %images/setup.png data "Title" "Body"
5
6                DESCRIPTION:
7                        A title and text with an optional image to the left.
8                        If an image is specified then height is set to image height.
9        }
10        font:   default-font-top
11        rebind: make function! [] [
12                font/name: effects/font
13                font/size: sizes/font
14        ]
15        init:   make function! [/local p indent] [
16                indent: either image [size/y: image/size/y image/size/x + sizes/line] [sizes/line]
17                p: self
18                ;       create title text
19                pane: make subface [
20                        offset: as-pair indent sizes/line
21                        size:   as-pair p/size/x - indent - sizes/line 10000
22                        text:   p/data
23                        font:   make default-font-bold [size: to integer! sizes/font / .75]
24                        para:   default-para-wrap
25                ]
26                pane/size: 5x5 + size-text pane
27                ;       create body text
28                para: make default-para-wrap compose [
29                        origin: (as-pair indent p/pane/size/y + sizes/line + sizes/line)
30                        margin: (as-pair sizes/line 0)
31                ]
32                ;       auto-height?
33                all [not image negative? size/y size/y: 10000 size/y: para/origin/y + second size-text self]
34                data: none
35        ]
36]
Note: See TracBrowser for help on using the browser.