menus: ESC should close menu popup
parent
3911f7b88c
commit
d59b2d2f3d
|
@ -3,13 +3,19 @@
|
||||||
USING: accessors kernel locals math.rectangles math.vectors
|
USING: accessors kernel locals math.rectangles math.vectors
|
||||||
namespaces opengl sequences sorting ui.commands ui.gadgets
|
namespaces opengl sequences sorting ui.commands ui.gadgets
|
||||||
ui.gadgets.buttons ui.gadgets.glass ui.gadgets.packs
|
ui.gadgets.buttons ui.gadgets.glass ui.gadgets.packs
|
||||||
ui.gadgets.worlds ui.gestures ui.operations
|
ui.gadgets.worlds ui.gadgets.wrappers ui.gestures ui.operations
|
||||||
ui.pens ui.pens.solid ui.theme ui.tools.common ;
|
ui.pens ui.pens.solid ui.theme ui.tools.common ;
|
||||||
|
|
||||||
|
FROM: ui.gadgets.wrappers => wrapper ;
|
||||||
|
|
||||||
IN: ui.gadgets.menus
|
IN: ui.gadgets.menus
|
||||||
|
|
||||||
: show-menu ( owner menu -- )
|
: (show-menu) ( owner menu -- )
|
||||||
[ find-world ] dip hand-loc get-global point>rect show-glass ;
|
[ find-world ] dip hand-loc get-global point>rect show-glass ;
|
||||||
|
|
||||||
|
: show-menu ( owner menu -- )
|
||||||
|
[ (show-menu) ] keep request-focus ;
|
||||||
|
|
||||||
GENERIC: <menu-item> ( target hook command -- button )
|
GENERIC: <menu-item> ( target hook command -- button )
|
||||||
|
|
||||||
M:: object <menu-item> ( target hook command -- button )
|
M:: object <menu-item> ( target hook command -- button )
|
||||||
|
@ -43,12 +49,19 @@ M: ---- <menu-item>
|
||||||
{ 0 5 } >>dim
|
{ 0 5 } >>dim
|
||||||
menu-border-color <separator-pen> >>interior ;
|
menu-border-color <separator-pen> >>interior ;
|
||||||
|
|
||||||
|
TUPLE: menu < wrapper ;
|
||||||
|
|
||||||
|
menu H{
|
||||||
|
{ T{ key-down f f "ESC" } [ hide-glass ] }
|
||||||
|
} set-gestures
|
||||||
|
|
||||||
: <menu> ( gadgets -- menu )
|
: <menu> ( gadgets -- menu )
|
||||||
<menu-items>
|
<menu-items>
|
||||||
{ 0 3 } >>gap
|
{ 0 3 } >>gap
|
||||||
margins
|
margins
|
||||||
menu-border-color <solid> >>boundary
|
menu-border-color <solid> >>boundary
|
||||||
menu-background <solid> >>interior ;
|
menu-background <solid> >>interior
|
||||||
|
menu new-wrapper ;
|
||||||
|
|
||||||
: <commands-menu> ( target hook commands -- menu )
|
: <commands-menu> ( target hook commands -- menu )
|
||||||
[ <menu-item> ] 2with map <menu> ;
|
[ <menu-item> ] 2with map <menu> ;
|
||||||
|
|
Loading…
Reference in New Issue