1 ! Copyright (C) 2006, 2009 Slava Pestov, 2015 Nicolas PĂ©net.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors colors.constants kernel system ui.gadgets
4 ui.gadgets.borders ui.gadgets.labels ui.gadgets.packs
5 ui.theme ui.gadgets.tracks ui.pens.gradient
6 ui.pens.solid ui.tools.common ;
9 TUPLE: labeled-gadget < track content color ;
13 M: labeled-gadget focusable-child* content>> ;
15 ! gradients don't work as backgrounds on windows, see #152 and #1397
16 : title-bar-interior ( -- interior )
18 [ toolbar-background <solid> ]
19 [ title-bar-gradient <gradient> ]
22 : add-title-bar ( title track -- track )
24 [ t >>bold? text-color >>foreground ] change-font
26 title-bar-interior >>interior
29 : add-content ( content track -- track )
32 : add-color-line ( color track -- track )
33 <shelf> { 0 1.5 } <border>
34 rot <solid> >>interior
37 : add-content-area ( labeled -- labeled )
38 [ ] [ content>> ] [ color>> ] tri
46 : <labeled> ( gadget title color -- labeled )
47 vertical labeled-gadget new-track with-lines
53 : <framed-labeled> ( gadget title color -- labeled )
54 <labeled> labeled-border-color <solid> >>boundary ;
56 : <labeled-gadget> ( gadget title -- labeled )
57 vertical labeled-gadget new-track with-lines
59 swap [ >>content ] keep
63 content-background <solid> >>interior
65 labeled-border-color <solid> >>boundary