]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/gadgets/grids/grids-docs.factor
1c00bedea8e2627db470ac4d3b7e16552d464021
[factor.git] / basis / ui / gadgets / grids / grids-docs.factor
1 USING: ui.gadgets help.markup help.syntax arrays ;
2 IN: ui.gadgets.grids
3
4 ARTICLE: "ui-grid-layout" "Grid layouts"
5 "Grid gadgets layout their children in a rectangular grid."
6 { $subsection grid }
7 "Creating grids from a fixed set of gadgets:"
8 { $subsection <grid> }
9 "Managing children:"
10 { $subsection grid-add }
11 { $subsection grid-remove }
12 { $subsection grid-child } ;
13
14 HELP: grid
15 { $class-description "A grid gadget lays out its children so that all gadgets in a column have equal width and all gadgets in a row have equal height."
16 $nl
17 "The " { $snippet "gap" } " slot stores a pair of integers, the horizontal and vertical gap between children, respectively."
18 $nl
19 "The " { $snippet "fill?" } " slot stores a boolean, indicating if grid cells should assume their preferred size, or if they should fill the dimensions of the cell. The default is " { $link t } "."
20 $nl
21 "Grids are created by calling " { $link <grid> } " and children are managed with " { $link grid-add } " and " { $link grid-remove } "."
22 $nl
23 "The " { $link add-gadget } ", " { $link unparent } " and " { $link clear-gadget } " words should not be used to manage child gadgets of grids." } ;
24
25 HELP: <grid>
26 { $values { "children" "a sequence of sequences of gadgets" } { "grid" "a new " { $link grid } } }
27 { $description "Creates a new " { $link grid } " gadget with the given children." } ;
28
29 HELP: grid-child
30 { $values { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } { "gadget" gadget } }
31 { $description "Outputs the child gadget at the " { $snippet "i" } "," { $snippet "j" } "th position of the grid." }
32 { $errors "Throws an error if the indices are out of bounds." } ;
33
34 HELP: grid-add
35 { $values { "grid" grid } { "child" gadget } { "i" "non-negative integer" } { "j" "non-negative integer" } }
36 { $description "Adds a child gadget at the specified location." }
37 { $side-effects "grid" } ;
38
39 HELP: grid-remove
40 { $values { "grid" grid } { "i" "non-negative integer" } { "j" "non-negative integer" } }
41 { $description "Removes a child gadget from the specified location." }
42 { $side-effects "grid" } ;
43
44 ABOUT: "ui-grid-layout"