! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: locals accessors kernel math namespaces sequences math.vectors math.rectangles.positioning colors colors.constants math.rectangles ui.commands ui.operations ui.gadgets ui.gadgets.buttons ui.gadgets.worlds ui.gestures ui.gadgets.theme ui.gadgets.packs ui.gadgets.glass ui.gadgets.borders ; IN: ui.gadgets.menus : menu-loc ( world menu -- loc ) [ hand-loc get { 0 0 } ] 2dip pref-dim swap dim>> popup-loc ; : show-menu ( owner menu -- ) [ find-world ] dip 2dup menu-loc show-glass ; :: ( target hook command -- button ) command command-name [ hook call target command command-button-quot call hand-clicked get find-world hide-glass ] ; : menu-theme ( gadget -- gadget ) COLOR: light-gray solid-interior faint-boundary ; : ( target hook commands -- menu ) [ ] 3dip [ add-gadget ] with with each { 5 5 } menu-theme ; : show-commands-menu ( target commands -- ) [ dup [ ] ] dip show-menu ; : ( target hook -- menu ) over object-operations ; : show-operations-menu ( gadget target hook -- ) show-menu ;