factor/library/ui/menus.factor

22 lines
742 B
Factor
Raw Normal View History

2005-03-01 22:11:08 -05:00
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: gadgets
USING: generic kernel lists math namespaces sequences ;
2005-03-01 22:11:08 -05:00
: show-menu ( menu -- )
hand screen-loc over set-rect-loc show-glass ;
2005-03-01 22:11:08 -05:00
2005-08-26 21:42:43 -04:00
: menu-items ( assoc -- pile )
2005-03-02 21:26:11 -05:00
#! Given an association list mapping labels to quotations.
#! Prepend a call to hide-menu to each quotation.
2005-08-26 21:42:43 -04:00
[ uncons \ hide-glass swons >r <label> r> <roll-button> ] map
1 <pile> [ add-gadgets ] keep ;
2005-03-01 22:11:08 -05:00
2005-08-26 00:55:56 -04:00
: menu-theme ( menu -- )
<< gradient f { 1 0 0 } { 240 240 255 } { 216 216 216 } >>
interior set-paint-prop ;
2005-08-26 21:42:43 -04:00
: <menu> ( assoc -- gadget )
2005-03-01 22:11:08 -05:00
#! Given an association list mapping labels to quotations.
2005-08-26 21:42:43 -04:00
menu-items line-border dup menu-theme ;