define-command ( word hash -- ) (original) (raw)

define-command ( word hash -- )
Factor handbook » UI framework » Implementing new gadgets » UI gestures » Commands

Next: define-command-map ( class group blurb pairs -- )

Vocabulary
ui.commands

Inputs

word a word
hash a hashtable

Outputs
None

Word description
Defines a command. The hashtable can contain the following keys:

+nullary+ - if set to a true value, the word must have stack effect ( -- ); otherwise it must have stack effect ( target -- )
+listener+ - if set to a true value, the command will run in the listener
+description+ - can be set to a string description of the command

Definition

USING: accessors assocs kernel ;

IN: ui.commands

: define-command ( word hash -- )
default-flags swap assoc-union [ assoc-union ] curry
change-props drop ;