ui: add find-windows to find multiple worlds matching a predicate
parent
abb3089a97
commit
e07ba18839
|
@ -53,6 +53,10 @@ HELP: fullscreen?
|
||||||
|
|
||||||
{ fullscreen? set-fullscreen } related-words
|
{ fullscreen? set-fullscreen } related-words
|
||||||
|
|
||||||
|
HELP: find-windows
|
||||||
|
{ $values { "quot" { $quotation ( world -- ? ) } } { "seq" sequence } }
|
||||||
|
{ $description "Finds all native windows such that the gadget passed to " { $link open-window } " satisfies the quotation, outputting an empty sequence if no such gadget could be found. The front-most native window is the last in the " { $snippet "seq" } "." } ;
|
||||||
|
|
||||||
HELP: find-window
|
HELP: find-window
|
||||||
{ $values { "quot" { $quotation ( world -- ? ) } } { "world/f" { $maybe world } } }
|
{ $values { "quot" { $quotation ( world -- ? ) } } { "world/f" { $maybe world } } }
|
||||||
{ $description "Finds a native window such that the gadget passed to " { $link open-window } " satisfies the quotation, outputting " { $link f } " if no such gadget could be found. The front-most native window is checked first." } ;
|
{ $description "Finds a native window such that the gadget passed to " { $link open-window } " satisfies the quotation, outputting " { $link f } " if no such gadget could be found. The front-most native window is checked first." } ;
|
||||||
|
|
|
@ -140,10 +140,13 @@ SYMBOL: ui-running
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: find-window ( quot: ( world -- ? ) -- world/f )
|
: find-windows ( quot: ( world -- ? ) -- seq )
|
||||||
[ ui-windows get-global values ] dip
|
[ ui-windows get-global values ] dip
|
||||||
'[ dup children>> [ ] [ nip first ] if-empty @ ]
|
'[ dup children>> [ ] [ nip first ] if-empty @ ]
|
||||||
find-last nip ; inline
|
filter ; inline
|
||||||
|
|
||||||
|
: find-window ( quot: ( world -- ? ) -- world/f )
|
||||||
|
find-windows ?last ; inline
|
||||||
|
|
||||||
: ui-running? ( -- ? )
|
: ui-running? ( -- ? )
|
||||||
ui-running get-global ;
|
ui-running get-global ;
|
||||||
|
|
Loading…
Reference in New Issue