]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/gadgets/buttons/buttons-docs.factor
Fix conflict in images vocab
[factor.git] / basis / ui / gadgets / buttons / buttons-docs.factor
1 USING: help.markup help.syntax ui.gadgets ui.gadgets.labels
2 ui.pens kernel models classes ;
3 IN: ui.gadgets.buttons
4
5 HELP: button
6 { $class-description "A button is a " { $link gadget } " which responds to mouse clicks by invoking a quotation."
7 $nl
8 "A button's appearance can vary depending on the state of the mouse button if the " { $snippet "interior" } " or " { $snippet "boundary" } " slots are set to instances of " { $link button-pen } "."
9 $nl
10 "A button can be selected, which is distinct from being pressed. This state is held in the " { $snippet "selected?" } " slot, and is used by " { $link checkbox } " instances to render themselves when they're checked." } ;
11
12 HELP: <button>
13 { $values { "label" gadget } { "quot" { $quotation "( button -- )" } } { "button" "a new " { $link button } } }
14 { $description "Creates a new " { $link button } " which calls the quotation when clicked. The given gadget becomes the button's only child." } ;
15
16 HELP: <roll-button>
17 { $values { "label" "a label specifier" } { "quot" { $quotation "( button -- )" } } { "button" button } }
18 { $description "Creates a new " { $link button } " which is displayed with a solid border when it is under the mouse, informing the user that the gadget is clickable." } ;
19
20 HELP: <border-button>
21 { $values { "label" "a label specifier" } { "quot" { $quotation "( button -- )" } } { "button" button } }
22 { $description "Creates a new " { $link button } " with a border which is always visible. The button appearance changes in response to mouse gestures using a " { $link button-pen } "." } ;
23
24 HELP: <repeat-button>
25 { $values { "label" object } { "quot" { $quotation "( button -- )" } } { "button" repeat-button } }
26 { $description "Creates a new " { $link button } " derived from a " { $link <border-button> } " which calls the quotation every 100 milliseconds as long as the mouse button is held down." } ;
27
28 HELP: button-pen
29 { $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " gneeric words by delegating to an object in one of four slots which depend on the state of the button being drawn:"
30     { $list
31         { { $snippet "plain"    } " - the button is inactive" }
32         { { $snippet "rollover" } " - the button is under the mouse" }
33         { { $snippet "pressed"  } " - the button is under the mouse and a mouse button is held down" }
34         { { $snippet "selected" } " - the button is selected (see " { $link checkbox }  }
35         { { $snippet "selected" } " - the button is selected and a mouse button is being held down (see " { $link checkbox }  }
36     }
37 "The " { $link <roll-button> } " and " { $link <border-button> } " words create " { $link button } " instances with specific " { $link button-pen } "." } ;
38
39 HELP: <command-button>
40 { $values { "target" object } { "gesture" "a gesture" } { "command" "a command" } { "button" "a new " { $link button } } }
41 { $description "Creates a " { $link <border-button> } " which invokes the command on " { $snippet "target" } " when clicked." } ;
42
43 HELP: <toolbar>
44 { $values { "target" object } { "toolbar" gadget } }
45 { $description "Creates a row of " { $link <command-button> } " gadgets invoking commands on " { $snippet "target" } ". The commands are taken from the " { $snippet "\"toolbar\"" } " command group of each class in " { $snippet "classes" } "." } ;
46
47 ARTICLE: "ui.gadgets.buttons" "Button gadgets"
48 "The " { $vocab-link "ui.gadgets.buttons" } " vocabulary implements buttons. Buttons respond to mouse clicks by invoking a quotation."
49 { $subsection button }
50 "There are many ways to create a new button:"
51 { $subsection <button> }
52 { $subsection <roll-button> }
53 { $subsection <border-button> }
54 { $subsection <repeat-button> }
55 "Gadgets for invoking commands:"
56 { $subsection <command-button> }
57 { $subsection <toolbar> }
58 "Button appearance can be customized:"
59 { $subsection button-pen }
60 "Button constructors take " { $emphasis "label specifiers" } " as input. A label specifier is either a string, an array of strings, a gadget or " { $link f } "."
61 { $see-also <command-button> "ui-commands" } ;
62
63 ABOUT: "ui.gadgets.buttons"