2 USING: help hashtables strings kernel ;
5 { $values { "class" "a class word" } { "hash" hashtable } }
6 { $description "Sets the gestures a gadget class responds to. The hashtable maps gestures to quotations with stack effect " { $snippet "( gadget -- )" } "." }
7 { $notes "Only one of " { $link define-commands } " and " { $link set-gestures } " can be used on a given gadget class, since each word will overwrite the other word's definitions." } ;
10 { $values { "gadget" "the receiver of the gesture" } { "gesture" "a gesture" } { "delegate" "an object" } { "?" "a boolean" } }
11 { $contract "Handles a gesture sent to a gadget. As the delegation chain is traversed, this generic word is called with every delegate of the gadget at the top of the stack, however the front-most delegate remains fixed as the " { $snippet "gadget" } " parameter."
13 "Outputs " { $link f } " if the gesture was handled, and " { $link t } " if the gesture should be passed on to the gadget's delegate." }
14 { $notes "Methods should be defined on this word if you desire to handle an arbitrary set of gestures. To define handlers for a fixed set, it is easier to use " { $link set-gestures } " or " { $link define-commands } "." } ;
17 { $values { "gesture" "a gesture" } { "gadget" gadget } { "?" "a boolean" } }
18 { $description "Calls " { $link handle-gesture* } " on every delegate of " { $snippet "gadget" } ". Outputs " { $link f } " if some delegate handled the gesture, else outputs " { $link t } "." }
19 { $see-also set-gestures define-commands } ;
22 { $values { "gesture" "a gesture" } { "gadget" gadget } { "?" "a boolean" } }
23 { $description "Calls " { $link send-gesture } " on every parent of " { $snippet "gadget" } ". Outputs " { $link f } " if some parent handled the gesture, else outputs " { $link t } "." }
24 { $see-also set-gestures define-commands } ;
27 { $values { "str" string } { "gadget" gadget } }
28 { $description "Calls " { $link user-input* } " on every parent of the gadget." } ;
31 { $class-description "Mouse motion gesture." } ;
34 { $class-description "Mouse drag gesture. The " { $link drag-# } " slot is either set to a mouse button number, or " { $link f } " indicating no specific button is expected." } ;
37 { $class-description "Mouse button up gesture. Instances have two slots:"
39 { { $link button-up-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
40 { { $link button-up-# } " - a mouse button number, or " { $link f } " indicating no specific button is expected" }
45 { $class-description "Mouse button down gesture. Instances have two slots:"
47 { { $link button-down-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
48 { { $link button-down-# } " - a mouse button number, or " { $link f } " indicating no specific button is expected" }
53 { $class-description "Scroll wheel motion gesture. When this gesture is sent, the " { $link scroll-direction } " global variable is set to a direction vector." } ;
56 { $class-description "Gesture sent when the mouse enters the bounds of a gadget." } ;
59 { $class-description "Gesture sent when the mouse leaves the bounds of a gadget." } ;
62 { $class-description "Gesture sent when a gadget gains keyboard focus." } ;
65 { $class-description "Gesture sent when a gadget loses keyboard focus." } ;
68 { $class-description "Gesture sent when the " { $emphasis "cut" } " standard window system action is invoked." } ;
71 { $class-description "Gesture sent when the " { $emphasis "copy" } " standard window system action is invoked." } ;
74 { $class-description "Gesture sent when the " { $emphasis "paste" } " standard window system action is invoked." } ;
77 { $class-description "Gesture sent when the " { $emphasis "delete" } " standard window system action is invoked." } ;
79 HELP: select-all-action
80 { $class-description "Gesture sent when the " { $emphasis "select all" } " standard window system action is invoked." } ;
82 HELP: generalize-gesture
83 { $values { "gesture" "a gesture" } { "newgesture" "a new gesture" } }
84 { $description "Turns a " { $link button-down } ", " { $link button-up } " or " { $link drag } " action naming a specific mouse button into one which can apply regardless of which mouse button was pressed." } ;
87 { $description "Control key modifier." } ;
90 { $description "Alt key modifier." } ;
93 { $description "Meta key modifier. This is the Command key on Mac OS X." } ;
96 { $description "Shift key modifier." } ;
99 { $class-description "Key down gesture. Instances have two slots:"
101 { { $link key-down-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
102 { { $link key-down-sym } " - a string denoting the key pressed; see " { $link "keyboard-gestures" } }
107 { $class-description "Key up gesture. Instances have two slots:"
109 { { $link key-up-mods } " - a sequence of modifiers; see " { $link "keyboard-gestures" } }
110 { { $link key-up-sym } " - a string denoting the key pressed; see " { $link "keyboard-gestures" } }
115 { $var-description "Global variable. The gadget at the mouse location." } ;
118 { $var-description "Global variable. The " { $link world } " containing the gadget at the mouse location." } ;
121 { $var-description "Global variable. The mouse location relative to the top-left corner of the " { $link hand-world } "." }
122 { $see-also hand-rel } ;
125 { $var-description "Global variable. The gadget at the location of the most recent click." } ;
128 { $var-description "Global variable. The mouse location at the time of the most recent click relative to the top-left corner of the " { $link hand-world } "." }
129 { $see-also hand-click-loc } ;
132 { $var-description "Global variable. The number of times the mouse was clicked in short succession. This counter is reset when " { $link double-click-timeout } " expires." } ;
134 HELP: hand-last-button
135 { $var-description "Global variable. The mouse button most recently pressed." } ;
138 { $var-description "Global variable. The timestamp of the most recent mouse button click. This timestamp has the same format as the output value of " { $link millis } "." } ;
141 { $var-description "Global variable. A vector of mouse buttons currently held down." } ;
143 HELP: scroll-direction
144 { $var-description "Global variable. If the most recent gesture was a " { $link mouse-scroll } ", this holds a pair of integers indicating the direction of the scrolling as a two-dimensional vector." } ;
146 HELP: double-click-timeout
147 { $var-description "Global variable. The maximum delay between two button presses which will still increment " { $link hand-click# } "." } ;
150 { $values { "gesture" "a gesture" } }
151 { $description "Sends a gesture to the most recently clicked gadget, and if the gadget does not respond to the gesture, removes specific button number information from the gesture and sends it again." } ;
154 { $description "Sends a " { $link motion } " or " { $link drag } " gesture to the gadget under the mouse, depending on whenever a mouse button is being held down or not." } ;
156 HELP: forget-rollover
157 { $description "Sends " { $link mouse-leave } " gestures to all gadgets containing the gadget under the mouse, and resets the " { $link hand-gadget } " variable." } ;
160 { $values { "world" world } { "seq" "a new sequence" } }
161 { $description "If the top-level window containing the world has focus, outputs a sequence of parents of the currently focused gadget, otherwise outputs " { $link f } "." }
162 { $notes "This word is used to avoid sending " { $link gain-focus } " gestures to a gadget which requests focus on an unfocused top-level window, so that, for instance, a text editing caret does not appear in this case." } ;
165 { $values { "gadget" gadget } }
166 { $description "Gives keyboard focus to the " { $link focusable-child } " of the gadget. This may result in " { $link lose-focus } " and " { $link gain-focus } " gestures being sent." } ;
169 { $values { "loc" "a pair of integers" } }
170 { $description "Outputs the distance travelled by the mouse since the most recent press. Only meaningful inside a " { $link drag } " gesture handler." } ;
173 { $values { "gadget" gadget } { "loc" "a pair of integers" } }
174 { $description "Outputs the location of the mouse relative to the top-left corner of the gadget. Only meaningful inside a " { $link button-down } ", " { $link button-up } ", " { $link motion } " or " { $link drag } " gesture handler, where the gadget is contained in the same world as the gadget receiving the gesture." }
175 { $see-also hand-loc } ;
178 { $values { "gadget" gadget } { "loc" "a pair of integers" } }
179 { $description "Outputs the location of the last mouse relative to the top-left corner of the gadget. Only meaningful inside a " { $link button-down } ", " { $link button-up } ", " { $link motion } " or " { $link drag } " gesture handler, where the gadget is contained in the same world as the gadget receiving the gesture." } ;
182 { $values { "seq" "a new sequence" } }
183 { $description "Outputs a sequence where the first element is the " { $link hand-world } " and the last is the " { $link hand-gadget } ", with all parents in between." } ;