]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/gadgets/packs/packs-docs.factor
Fix conflict in images vocab
[factor.git] / basis / ui / gadgets / packs / packs-docs.factor
1 USING: ui.gadgets help.markup help.syntax generic kernel
2 classes.tuple quotations ui.gadgets.packs.private
3 ui.baseline-alignment ;
4 IN: ui.gadgets.packs
5
6 ARTICLE: "ui-pack-layout" "Pack layouts"
7 "Pack gadgets layout their children along a single axis."
8 { $subsection pack }
9 "Creating empty packs:"
10 { $subsection <pack> }
11 { $subsection <pile> }
12 { $subsection <shelf> }
13
14 "For more control, custom layouts can reuse portions of pack layout logic:"
15 { $subsection pack-pref-dim }
16 { $subsection pack-layout } ;
17
18 HELP: pack
19 { $class-description "A gadget which lays out its children along a single axis stored in the " { $snippet "orientation" } " slot. Can be constructed with one of the following words:"
20 { $list
21     { $link <pack> }
22     { $link <pile> }
23     { $link <shelf> }
24 }
25 "Packs have the following slots:"
26 { $list
27     { { $snippet "align" } " a rational number between 0 and 1, or " { $link +baseline+ } "; the alignment of gadgets along the axis perpendicular to the pack's orientation" }
28     { { $snippet "fill" } " a rational number between 0 and 1, where 0 gives each gadget its preferred size and 1 fills the dimension perpendicular to the pack's orientation" }
29     { { $snippet "gap" } " a pair of integers, the horizontal and vertical gap between children" }
30 }
31 "Custom gadgets can inherit from the " { $link pack } " class and implement their own " { $link pref-dim* } " and " { $link layout* } " methods, reusing pack layout logic by calling " { $link pack-pref-dim } " and " { $link pack-layout } "." } ;
32
33 HELP: pack-layout
34 { $values { "pack" "a new " { $link pack } } { "sizes" "a sequence of pairs of integers" } }
35 { $description "Lays out the pack's children along the " { $snippet "orientation" } " of the pack, with each gadget receiving its size from the corresponding index of the " { $snippet "sizes" } " sequence." }
36 { $notes
37     "This word is useful if you are writing your own layout gadget which inherits from " { $link pack } ". This allows you to reuse layout logic while computing gadget sizes using a custom procedure."
38 } ;
39
40 HELP: <pack>
41 { $values { "orientation" "an orientation specifier" } { "pack" "a new " { $link pack } } }
42 { $description "Creates a new pack which lays out children with the given orientation, either " { $link horizontal } " or " { $link vertical } "." } ;
43
44 { <pack> <pile> <shelf> } related-words
45
46 HELP: <pile>
47 { $values { "pack" "a new " { $link pack } } }
48 { $description "Creates a new " { $link pack } " which lays out its children vertically." } ;
49
50 HELP: <shelf>
51 { $values { "pack" "a new " { $link pack } } }
52 { $description "Creates a new " { $link pack } " which lays out its children horizontally." } ;
53
54 HELP: pack-pref-dim
55 { $values { "pack" pack } { "sizes" "a sequence of pairs of integers" } { "dim" "a pair of integers" } }
56 { $description "Computes the preferred size of a pack, with each gadget receiving its size from the corresponding index of the " { $snippet "sizes" } " sequence." }
57 { $notes
58     "This word is useful if you are writing your own layout gadget which inherits from " { $link pack } ". This allows you to reuse layout logic while computing gadget sizes using a custom procedure."
59 } ;
60
61 ABOUT: "ui-pack-layout"