1 USING: help.markup help.syntax ui.gadgets ui.gadgets.labels
2 ui.render kernel models classes ;
6 { $class-description "A button is a " { $link gadget } " which responds to mouse clicks by invoking a quotation."
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-paint } "."
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 the " { $link <toggle-buttons> } " word to construct a row of buttons for choosing among several alternatives." } ;
13 { $values { "label" gadget } { "quot" "a quotation with stack effect " { $snippet "( 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." } ;
17 { $values { "label" "a label specifier" } { "quot" "a quotation with stack effect " { $snippet "( 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." } ;
21 { $values { "label" "a label specifier" } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" button } }
22 { $description "Creates a new " { $link button } " with a shaded border which is always visible. The button appearance changes in response to mouse gestures using a " { $link button-paint } "." } ;
25 { $values { "label" object } { "quot" "a quotation with stack effect " { $snippet "( button -- )" } } { "button" repeat-button } }
26 { $description "Creates a new " { $link button } " derived from a " { $link <bevel-button> } " which calls the quotation every 100 milliseconds as long as the mouse button is held down." } ;
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:"
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 <toggle-buttons> } }
36 "The " { $link <roll-button> } " and " { $link <bevel-button> } " words create " { $link button } " instances with specific " { $link button-paint } "." } ;
39 { $values { "model" model } { "value" object } { "label" "a label specifier" } { "gadget" gadget } }
41 "Creates a " { $link <bevel-button> } " which sets the model's value to " { $snippet "value" } " when pressed. After being pressed, the button becomes selected until the value of the model changes again."
43 { $notes "Typically a row of radio controls should be built together using " { $link <toggle-buttons> } "." } ;
45 HELP: <toggle-buttons>
46 { $values { "model" model } { "assoc" "an association list mapping labels to objects" } { "gadget" gadget } }
47 { $description "Creates a row of labelled " { $link <toggle-button> } " gadgets which change the value of the model." } ;
49 HELP: <command-button>
50 { $values { "target" object } { "gesture" "a gesture" } { "command" "a command" } { "button" "a new " { $link button } } }
51 { $description "Creates a " { $link <bevel-button> } " which invokes the command on " { $snippet "target" } " when clicked." } ;
54 { $values { "target" object } { "toolbar" gadget } }
55 { $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" } "." } ;
57 ARTICLE: "ui.gadgets.buttons" "Button gadgets"
58 "Buttons respond to mouse clicks by invoking a quotation."
59 { $subsection button }
60 "There are many ways to create a new button:"
61 { $subsection <button> }
62 { $subsection <roll-button> }
63 { $subsection <bevel-button> }
64 { $subsection <repeat-button> }
65 "Gadgets for invoking commands:"
66 { $subsection <command-button> }
67 { $subsection <toolbar> }
68 "A radio box is a row of buttons for choosing amongst several distinct possibilities:"
69 { $subsection <toggle-buttons> }
70 "Button appearance can be customized:"
71 { $subsection button-paint }
72 "Button constructors take " { $emphasis "label specifiers" } " as input. A label specifier is either a string, an array of strings, a gadget or " { $link f } "."
73 { $see-also <command-button> "ui-commands" } ;