UI gestures
Factor handbook » UI framework » Implementing new gadgets

Prev:<gadget> ( -- gadget )
Next:Customizing gadget appearance

User actions such as keyboard input and mouse button clicks deliver gestures to gadgets. If the direct receiver of the gesture does not handle it, the gesture is passed on to the receiver's parent, and this way it travels up the gadget hierarchy. Gestures which are not handled at some point are ignored.

There are two ways to define gesture handling logic. The simplest way is to associate a fixed set of gestures with a class:
set-gestures ( class hash -- )

Another way is to define a generic word on a class which handles all gestures sent to gadgets of that class:
handle-gesture ( gesture gadget -- ? )

Sometimes a gesture needs to be presented to the user:
gesture>string ( gesture -- string/f )

Keyboard input:
Keyboard focus
Keyboard gestures
Action gestures
Free-form keyboard input

Mouse input:
Mouse gestures
Multi-touch gestures
File drop gestures

Guidelines for cross-platform applications:
Gesture handling differences between platforms

Abstractions built on top of gestures: