ui: rename windows to ui-windows
parent
dfa763434e
commit
958d5e61b2
|
@ -7,7 +7,7 @@ IN: ui.event-loop
|
|||
: event-loop? ( -- ? )
|
||||
{
|
||||
{ [ graft-queue deque-empty? not ] [ t ] }
|
||||
{ [ windows get-global empty? not ] [ t ] }
|
||||
{ [ ui-windows get-global empty? not ] [ t ] }
|
||||
[ f ]
|
||||
} cond ;
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ vocabs.loader ;
|
|||
|
||||
IN: ui
|
||||
|
||||
HELP: windows
|
||||
HELP: ui-windows
|
||||
{ $var-description "Global variable holding an association list mapping native window handles to " { $link world } " instances." } ;
|
||||
|
||||
{ windows open-window find-window world-attributes } related-words
|
||||
{ ui-windows open-window find-window world-attributes } related-words
|
||||
|
||||
HELP: open-window
|
||||
{ $values { "gadget" gadget } { "title/attributes" { "a " { $link string } " or a " { $link world-attributes } " tuple" } } }
|
||||
|
@ -47,12 +47,12 @@ HELP: find-window
|
|||
|
||||
HELP: register-window
|
||||
{ $values { "world" world } { "handle" "a backend-specific handle" } }
|
||||
{ $description "Adds a window to the global " { $link windows } " variable." }
|
||||
{ $description "Adds a window to the global " { $link ui-windows } " variable." }
|
||||
{ $notes "This word should only be called by the UI backend. User code can open new windows with " { $link open-window } "." } ;
|
||||
|
||||
HELP: unregister-window
|
||||
{ $values { "handle" "a backend-specific handle" } }
|
||||
{ $description "Removes a window from the global " { $link windows } " variable." }
|
||||
{ $description "Removes a window from the global " { $link ui-windows } " variable." }
|
||||
{ $notes "This word should only be called only by the UI backend, and not user code." } ;
|
||||
|
||||
HELP: (with-ui)
|
||||
|
@ -150,7 +150,7 @@ ARTICLE: "ui-windows" "Top-level windows"
|
|||
"Finding top-level windows:"
|
||||
{ $subsections find-window }
|
||||
"Top-level windows are stored in a global variable:"
|
||||
{ $subsections windows }
|
||||
{ $subsections ui-windows }
|
||||
"When a gadget is displayed in a top-level window, or added to a parent which is already showing in a top-level window, a generic word is called allowing the gadget to perform initialization tasks:"
|
||||
{ $subsections graft* }
|
||||
"When the gadget is removed from a parent shown in a top-level window, or when the top-level window is closed, a corresponding generic word is called to clean up:"
|
||||
|
|
|
@ -13,9 +13,9 @@ IN: ui
|
|||
<PRIVATE
|
||||
|
||||
! Assoc mapping aliens to gadgets
|
||||
SYMBOL: windows
|
||||
SYMBOL: ui-windows
|
||||
|
||||
: window ( handle -- world ) windows get-global at ;
|
||||
: window ( handle -- world ) ui-windows get-global at ;
|
||||
|
||||
: register-window ( world handle -- )
|
||||
#! Add the new window just below the topmost window. Why?
|
||||
|
@ -24,15 +24,15 @@ SYMBOL: windows
|
|||
#! in the new window when it appears) Factor doesn't get
|
||||
#! confused and send workspace operations to the new window,
|
||||
#! etc.
|
||||
swap 2array windows get-global push
|
||||
windows get-global dup length 1 >
|
||||
swap 2array ui-windows get-global push
|
||||
ui-windows get-global dup length 1 >
|
||||
[ [ length 1 - dup 1 - ] keep exchange ] [ drop ] if ;
|
||||
|
||||
: unregister-window ( handle -- )
|
||||
windows [ [ first = ] with reject ] change-global ;
|
||||
ui-windows [ [ first = ] with reject ] change-global ;
|
||||
|
||||
: raised-window ( world -- )
|
||||
windows get-global
|
||||
ui-windows get-global
|
||||
[ [ second eq? ] with find drop ] keep
|
||||
[ nth ] [ remove-nth! drop ] [ nip ] 2tri push ;
|
||||
|
||||
|
@ -108,7 +108,7 @@ M: world ungraft*
|
|||
<dlist> \ graft-queue set-global
|
||||
<dlist> \ layout-queue set-global
|
||||
<dlist> \ gesture-queue set-global
|
||||
V{ } clone windows set-global ;
|
||||
V{ } clone ui-windows set-global ;
|
||||
|
||||
: update-hand ( world -- )
|
||||
dup hand-world get-global eq?
|
||||
|
@ -147,7 +147,7 @@ SYMBOL: ui-thread
|
|||
PRIVATE>
|
||||
|
||||
: find-window ( quot: ( world -- ? ) -- world )
|
||||
[ windows get-global values ] dip
|
||||
[ ui-windows get-global values ] dip
|
||||
'[ dup children>> [ ] [ nip first ] if-empty @ ]
|
||||
find-last nip ; inline
|
||||
|
||||
|
@ -202,7 +202,7 @@ PRIVATE>
|
|||
find-world raise-window* ;
|
||||
|
||||
: topmost-window ( -- world )
|
||||
windows get-global last second ;
|
||||
ui-windows get-global last second ;
|
||||
|
||||
HOOK: close-window ui-backend ( gadget -- )
|
||||
|
||||
|
|
Loading…
Reference in New Issue