! Copyright (C) 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: gadgets-presentations USING: compiler gadgets gadgets-buttons gadgets-labels gadgets-menus gadgets-panes generic hashtables inference inspector io jedit kernel lists memory namespaces parser prettyprint sequences styles vectors words ; SYMBOL: commands { } clone commands global set-hash : define-command ( class name quot -- ) 3vector commands get push ; : applicable ( object -- seq ) commands get [ first call ] subset-with ; : command-quot ( presented quot -- quot ) [ [ swap literalize , % ] [ ] make , [ pane get pane-call ] % ] [ ] make ; : command-menu ( presented -- menu ) dup applicable [ [ third command-quot ] keep second swons ] map-with ; : init-commands ( gadget -- gadget ) dup presented paint-prop [ [ \ drop , literalize , [ command-menu show-menu ] % ] [ ] make ] when* ; : ( style text -- label )