]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/gadgets/line-support/line-support-docs.factor
10587885e6dc529b69dfaac5a78141f91ce39dad
[factor.git] / basis / ui / gadgets / line-support / line-support-docs.factor
1 USING: arrays colors fonts help.markup help.syntax
2 ui.gadgets.scrollers ;
3 IN: ui.gadgets.line-support
4
5 HELP: line-gadget
6 { $class-description "Base class for gadgets that implements display of sequences of text."
7   $nl
8   "Line gadgets have the following slots:"
9   { $table
10     {
11         { $slot "font" }
12         { "a " { $link font } "." }
13     }
14     {
15         { $slot "selection-color" }
16         { "a " { $link color } "." }
17     }
18     {
19         { $slot "min-rows" }
20         { "The preferred minimum number of visible rows when the gadget is contained in a viewport." }
21     }
22     {
23         { $slot "max-rows" }
24         { "The preferred maximum number of visible rows when the gadget is cotnained in a viewport." }
25     }
26     {
27         { $slot "min-cols" }
28         { "The preferred minimum number of visible columns when the gadget is contained in a viewport." }
29     }
30     {
31         { $slot "max-cols" }
32         { "The preferred maximum number of visible columns when the gadget is contained in a viewport." }
33     }
34   }
35 } ;
36
37 HELP: pref-viewport-dim*
38 { $values { "gadget" line-gadget } { "dim" array } }
39 { $description "Calculates the preferred viewport dimenstions of the line gadget." }
40 { $see-also pref-viewport-dim } ;
41
42 ARTICLE: "ui.gadgets.line-support" "Gadget line support"
43 "The " { $vocab-link "ui.gadgets.line-support" } " vocabulary provides common code shared by gadgets which display a sequence of lines of text. Currently, the two gadgets that use it are " { $link "ui.gadgets.editors" } " and " { $link "ui.gadgets.tables" } "."
44 $nl
45 "The class of line gadgets:"
46 { $subsections
47     line-gadget
48     line-gadget?
49 }
50 "Line gadgets are backed by a model which must be a sequence. The number of lines in the gadget is the length of the sequence."
51 $nl
52 "Line gadgets cannot be created and used directly, instead a subclass must be defined:"
53 { $subsections new-line-gadget }
54 "Subclasses must implement a generic word:"
55 { $subsections draw-line }
56 "Two optional generic words may be implemented; if they are not implemented in the subclass, a default implementation based on font metrics will be used:"
57 { $subsections
58     line-height
59     line-leading
60 }
61 "Validating line numbers:"
62 { $subsections validate-line }
63 "Working with visible lines:"
64 { $subsections
65     visible-lines
66     first-visible-line
67     last-visible-line
68 }
69 "Converting y co-ordinates to line numbers, and vice versa:"
70 { $subsections
71     line>y
72     y>line
73 } ;
74
75 ABOUT: "ui.gadgets.line-support"