| 
									
										
										
										
											2010-05-24 16:50:09 -04:00
										 |  |  | ! Copyright (C) 2006, 2010 Slava Pestov. | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2010-06-16 16:32:50 -04:00
										 |  |  | USING: accessors arrays assocs boxes classes.tuple | 
					
						
							|  |  |  | classes.tuple.parser combinators combinators.short-circuit | 
					
						
							|  |  |  | concurrency.flags concurrency.promises continuations deques | 
					
						
							|  |  |  | destructors dlists fry init kernel lexer make math namespaces | 
					
						
							|  |  |  | parser sequences sets strings threads ui.backend ui.gadgets | 
					
						
							|  |  |  | ui.gadgets.private ui.gadgets.worlds ui.gestures vocabs.parser | 
					
						
							|  |  |  | words ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | IN: ui | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | <PRIVATE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! Assoc mapping aliens to gadgets | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  | SYMBOL: ui-windows | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  | : window ( handle -- world ) ui-windows get-global at ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : register-window ( world handle -- )
 | 
					
						
							| 
									
										
										
										
											2015-09-08 19:15:10 -04:00
										 |  |  |     ! Add the new window just below the topmost window. Why? | 
					
						
							|  |  |  |     ! So that if the new window doesn't actually receive focus | 
					
						
							|  |  |  |     ! (eg, we're using focus follows mouse and the mouse is not | 
					
						
							|  |  |  |     ! in the new window when it appears) Factor doesn't get | 
					
						
							|  |  |  |     ! confused and send workspace operations to the new window, | 
					
						
							|  |  |  |     ! etc. | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  |     swap 2array ui-windows get-global push
 | 
					
						
							|  |  |  |     ui-windows get-global dup length 1 >
 | 
					
						
							| 
									
										
										
										
											2009-08-13 20:21:44 -04:00
										 |  |  |     [ [ length 1 - dup 1 - ] keep exchange ] [ drop ] if ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : unregister-window ( handle -- )
 | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  |     ui-windows [ [ first = ] with reject ] change-global ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : raised-window ( world -- )
 | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  |     ui-windows get-global
 | 
					
						
							| 
									
										
										
										
											2008-05-06 10:16:48 -04:00
										 |  |  |     [ [ second eq? ] with find drop ] keep
 | 
					
						
							| 
									
										
										
										
											2009-10-28 00:41:57 -04:00
										 |  |  |     [ nth ] [ remove-nth! drop ] [ nip ] 2tri push ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-22 01:40:17 -05:00
										 |  |  | : focus-gestures ( new old -- )
 | 
					
						
							|  |  |  |     drop-prefix <reversed>
 | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:57 -05:00
										 |  |  |     lose-focus swap each-gesture | 
					
						
							|  |  |  |     gain-focus swap each-gesture ;
 | 
					
						
							| 
									
										
										
										
											2007-11-22 01:40:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-08 16:07:15 -04:00
										 |  |  | : ?grab-input ( world -- )
 | 
					
						
							|  |  |  |     dup grab-input?>> [ handle>> (grab-input) ] [ drop ] if ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : ?ungrab-input ( world -- )
 | 
					
						
							|  |  |  |     dup grab-input?>> [ handle>> (ungrab-input) ] [ drop ] if ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | : focus-world ( world -- )
 | 
					
						
							| 
									
										
										
										
											2008-09-27 15:36:04 -04:00
										 |  |  |     t >>focused? | 
					
						
							| 
									
										
										
										
											2009-05-08 16:07:15 -04:00
										 |  |  |     [ ?grab-input ] [ | 
					
						
							|  |  |  |         dup raised-window | 
					
						
							|  |  |  |         focus-path f focus-gestures | 
					
						
							|  |  |  |     ] bi ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : unfocus-world ( world -- )
 | 
					
						
							| 
									
										
										
										
											2008-09-27 15:36:04 -04:00
										 |  |  |     f >>focused? | 
					
						
							| 
									
										
										
										
											2009-05-08 16:07:15 -04:00
										 |  |  |     [ ?ungrab-input ] | 
					
						
							|  |  |  |     [ focus-path f swap focus-gestures ] bi ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-11 13:35:41 -04:00
										 |  |  | : set-up-window ( world -- )
 | 
					
						
							| 
									
										
										
										
											2009-05-03 23:01:35 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-07-01 18:57:21 -04:00
										 |  |  |         [ set-gl-context ] | 
					
						
							| 
									
										
										
										
											2009-05-11 13:35:41 -04:00
										 |  |  |         [ [ title>> ] keep set-title ] | 
					
						
							|  |  |  |         [ begin-world ] | 
					
						
							| 
									
										
										
										
											2009-05-03 23:01:35 -04:00
										 |  |  |         [ resize-world ] | 
					
						
							| 
									
										
										
										
											2009-05-11 13:35:41 -04:00
										 |  |  |         [ t >>active? drop ] | 
					
						
							|  |  |  |         [ request-focus ] | 
					
						
							| 
									
										
										
										
											2009-05-03 23:01:35 -04:00
										 |  |  |     } cleave ;
 | 
					
						
							| 
									
										
										
										
											2009-05-03 16:52:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-11 13:35:41 -04:00
										 |  |  | : clean-up-broken-window ( world -- )
 | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         dup { [ focused?>> ] [ grab-input?>> ] } 1&& | 
					
						
							|  |  |  |         [ handle>> (ungrab-input) ] [ drop ] if
 | 
					
						
							|  |  |  |     ] [ handle>> (close-window) ] bi ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-03 16:52:26 -04:00
										 |  |  | M: world graft* | 
					
						
							| 
									
										
										
										
											2009-05-11 13:35:41 -04:00
										 |  |  |     [ (open-window) ] | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         [ set-up-window ] | 
					
						
							|  |  |  |         [ [ clean-up-broken-window ] [ ui-error ] bi* ] recover
 | 
					
						
							|  |  |  |     ] bi ;
 | 
					
						
							| 
									
										
										
										
											2007-11-22 01:40:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-17 16:09:25 -04:00
										 |  |  | : dispose-window-resources ( world -- )
 | 
					
						
							|  |  |  |     [ <reversed> [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-24 16:50:09 -04:00
										 |  |  | M: world ungraft* | 
					
						
							| 
									
										
										
										
											2009-01-21 00:06:23 -05:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2009-07-01 18:57:21 -04:00
										 |  |  |         [ set-gl-context ] | 
					
						
							| 
									
										
										
										
											2009-04-01 00:44:38 -04:00
										 |  |  |         [ text-handle>> [ dispose ] when* ] | 
					
						
							| 
									
										
										
										
											2009-02-10 19:47:34 -05:00
										 |  |  |         [ images>> [ dispose ] when* ] | 
					
						
							| 
									
										
										
										
											2009-01-21 00:06:23 -05:00
										 |  |  |         [ hand-clicked close-global ] | 
					
						
							|  |  |  |         [ hand-gadget close-global ] | 
					
						
							| 
									
										
										
										
											2009-05-03 16:52:26 -04:00
										 |  |  |         [ end-world ] | 
					
						
							| 
									
										
										
										
											2010-07-17 16:09:25 -04:00
										 |  |  |         [ dispose-window-resources ] | 
					
						
							| 
									
										
										
										
											2010-05-24 16:50:09 -04:00
										 |  |  |         [ unfocus-world ] | 
					
						
							| 
									
										
										
										
											2010-07-17 16:08:36 -04:00
										 |  |  |         [ [ (close-window) f ] change-handle drop ] | 
					
						
							| 
									
										
										
										
											2010-06-16 16:32:50 -04:00
										 |  |  |         [ promise>> t swap fulfill ] | 
					
						
							| 
									
										
										
										
											2009-01-21 00:06:23 -05:00
										 |  |  |     } cleave ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-22 01:40:17 -05:00
										 |  |  | : init-ui ( -- )
 | 
					
						
							| 
									
										
										
										
											2010-05-24 16:50:09 -04:00
										 |  |  |     <box> drag-timer set-global
 | 
					
						
							|  |  |  |     f hand-gadget set-global
 | 
					
						
							|  |  |  |     f hand-clicked set-global
 | 
					
						
							|  |  |  |     f hand-world set-global
 | 
					
						
							|  |  |  |     f world set-global
 | 
					
						
							| 
									
										
										
										
											2007-11-22 01:40:17 -05:00
										 |  |  |     <dlist> \ graft-queue set-global
 | 
					
						
							|  |  |  |     <dlist> \ layout-queue set-global
 | 
					
						
							| 
									
										
										
										
											2008-11-22 00:01:20 -05:00
										 |  |  |     <dlist> \ gesture-queue set-global
 | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  |     V{ } clone ui-windows set-global ;
 | 
					
						
							| 
									
										
										
										
											2007-11-22 01:40:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | : update-hand ( world -- )
 | 
					
						
							|  |  |  |     dup hand-world get-global eq?
 | 
					
						
							|  |  |  |     [ hand-loc get-global swap move-hand ] [ drop ] if ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-31 23:26:51 -04:00
										 |  |  | : (layout-queued) ( deque -- seq )
 | 
					
						
							| 
									
										
										
										
											2007-10-21 18:10:27 -04:00
										 |  |  |     [ | 
					
						
							| 
									
										
										
										
											2007-11-16 01:19:13 -05:00
										 |  |  |         in-layout? on
 | 
					
						
							| 
									
										
										
										
											2012-07-31 23:26:51 -04:00
										 |  |  |         [ | 
					
						
							| 
									
										
										
										
											2007-10-21 18:10:27 -04:00
										 |  |  |             dup layout find-world [ , ] when*
 | 
					
						
							| 
									
										
										
										
											2008-08-19 15:06:20 -04:00
										 |  |  |         ] slurp-deque | 
					
						
							| 
									
										
										
										
											2012-07-31 23:26:51 -04:00
										 |  |  |     ] { } make members ; inline
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : layout-queued ( -- seq )
 | 
					
						
							|  |  |  |     layout-queue dup deque-empty? | 
					
						
							|  |  |  |     [ drop { } ] [ (layout-queued) ] if ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-10-21 18:10:27 -04:00
										 |  |  | : redraw-worlds ( seq -- )
 | 
					
						
							| 
									
										
										
										
											2007-11-23 17:23:53 -05:00
										 |  |  |     [ dup update-hand draw-world ] each ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-22 00:01:20 -05:00
										 |  |  | : send-queued-gestures ( -- )
 | 
					
						
							| 
									
										
										
										
											2008-12-10 17:40:05 -05:00
										 |  |  |     gesture-queue [ send-queued-gesture notify-queued ] slurp-deque ;
 | 
					
						
							| 
									
										
										
										
											2008-11-22 00:01:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 17:48:11 -05:00
										 |  |  | : update-ui ( -- )
 | 
					
						
							| 
									
										
										
										
											2009-04-07 23:30:13 -04:00
										 |  |  |     notify-queued | 
					
						
							|  |  |  |     layout-queued | 
					
						
							|  |  |  |     redraw-worlds | 
					
						
							|  |  |  |     send-queued-gestures ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 20:37:43 -05:00
										 |  |  | SYMBOL: ui-thread | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 17:48:11 -05:00
										 |  |  | : ui-running ( quot -- )
 | 
					
						
							|  |  |  |     t \ ui-running set-global
 | 
					
						
							|  |  |  |     [ f \ ui-running set-global ] [ ] cleanup ; inline
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | PRIVATE>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-22 20:19:51 -04:00
										 |  |  | : find-window ( quot: ( world -- ? ) -- world )
 | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  |     [ ui-windows get-global values ] dip
 | 
					
						
							| 
									
										
										
										
											2009-05-07 00:40:27 -04:00
										 |  |  |     '[ dup children>> [ ] [ nip first ] if-empty @ ] | 
					
						
							|  |  |  |     find-last nip ; inline
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 20:37:43 -05:00
										 |  |  | : ui-running? ( -- ? )
 | 
					
						
							|  |  |  |     \ ui-running get-global ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | <PRIVATE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 17:48:11 -05:00
										 |  |  | : update-ui-loop ( -- )
 | 
					
						
							| 
									
										
										
										
											2015-09-08 19:15:10 -04:00
										 |  |  |     ! Note the logic: if update-ui fails, we open an error window | 
					
						
							|  |  |  |     ! and run one iteration of update-ui. If that also fails, well, | 
					
						
							|  |  |  |     ! the whole UI subsystem is broken so we exit out of the | 
					
						
							|  |  |  |     ! update-ui-loop. | 
					
						
							| 
									
										
										
										
											2009-04-07 23:30:13 -04:00
										 |  |  |     [ { [ ui-running? ] [ ui-thread get-global self eq? ] } 0&& ] | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         ui-notify-flag get lower-flag | 
					
						
							|  |  |  |         [ update-ui ] [ ui-error update-ui ] recover
 | 
					
						
							|  |  |  |     ] while ;
 | 
					
						
							| 
									
										
										
										
											2008-02-25 17:48:11 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : start-ui-thread ( -- )
 | 
					
						
							| 
									
										
										
										
											2008-02-25 20:37:43 -05:00
										 |  |  |     [ self ui-thread set-global update-ui-loop ] | 
					
						
							|  |  |  |     "UI update" spawn drop ;
 | 
					
						
							| 
									
										
										
										
											2008-02-25 17:48:11 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | : start-ui ( quot -- )
 | 
					
						
							| 
									
										
										
										
											2009-03-16 04:01:47 -04:00
										 |  |  |     call( -- ) notify-ui-thread start-ui-thread ;
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-03 16:52:26 -04:00
										 |  |  | : ?attributes ( gadget title/attributes -- attributes )
 | 
					
						
							| 
									
										
										
										
											2012-04-18 20:46:01 -04:00
										 |  |  |     dup string? [ <world-attributes> swap >>title ] [ clone ] if
 | 
					
						
							| 
									
										
										
										
											2009-05-03 16:52:26 -04:00
										 |  |  |     swap [ [ [ 1array ] [ f ] if* ] curry unless* ] curry change-gadgets ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-19 17:54:27 -05:00
										 |  |  | PRIVATE>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-24 22:09:40 -05:00
										 |  |  | : open-world-window ( world -- )
 | 
					
						
							| 
									
										
										
										
											2008-09-27 15:36:04 -04:00
										 |  |  |     dup pref-dim >>dim dup relayout graft ;
 | 
					
						
							| 
									
										
										
										
											2007-11-24 22:09:40 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 12:03:34 -04:00
										 |  |  | : open-window* ( gadget title/attributes -- window )
 | 
					
						
							|  |  |  |     ?attributes <world> [ open-world-window ] keep ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-03 16:52:26 -04:00
										 |  |  | : open-window ( gadget title/attributes -- )
 | 
					
						
							| 
									
										
										
										
											2009-06-03 12:03:34 -04:00
										 |  |  |     open-window* drop ;
 | 
					
						
							| 
									
										
										
										
											2007-11-24 22:09:40 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-13 23:28:33 -04:00
										 |  |  | : set-fullscreen ( gadget ? -- )
 | 
					
						
							|  |  |  |     [ find-world ] dip (set-fullscreen) ;
 | 
					
						
							| 
									
										
										
										
											2008-02-11 02:53:20 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : fullscreen? ( gadget -- ? )
 | 
					
						
							| 
									
										
										
										
											2009-05-13 23:28:33 -04:00
										 |  |  |     find-world (fullscreen?) ;
 | 
					
						
							| 
									
										
										
										
											2008-02-11 02:53:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-13 21:05:22 -04:00
										 |  |  | : toggle-fullscreen ( gadget -- )
 | 
					
						
							| 
									
										
										
										
											2009-05-13 23:28:33 -04:00
										 |  |  |     dup fullscreen? not set-fullscreen ;
 | 
					
						
							| 
									
										
										
										
											2009-05-13 21:05:22 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-21 00:13:31 -05:00
										 |  |  | : raise-window ( gadget -- )
 | 
					
						
							|  |  |  |     find-world raise-window* ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-22 20:01:50 -04:00
										 |  |  | : topmost-window ( -- world )
 | 
					
						
							| 
									
										
										
										
											2015-06-10 18:20:55 -04:00
										 |  |  |     ui-windows get-global last second ;
 | 
					
						
							| 
									
										
										
										
											2009-06-22 20:01:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-24 22:09:40 -05:00
										 |  |  | HOOK: close-window ui-backend ( gadget -- )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: object close-window | 
					
						
							|  |  |  |     find-world [ ungraft ] when* ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-25 20:37:43 -05:00
										 |  |  | [ | 
					
						
							|  |  |  |     f \ ui-running set-global
 | 
					
						
							|  |  |  |     <flag> ui-notify-flag set-global
 | 
					
						
							| 
									
										
										
										
											2009-10-19 22:17:02 -04:00
										 |  |  | ] "ui" add-startup-hook | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-08 08:33:22 -04:00
										 |  |  | HOOK: resize-window ui-backend ( world dim -- )
 | 
					
						
							|  |  |  | M: object resize-window 2drop ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : relayout-window ( gadget -- )
 | 
					
						
							| 
									
										
										
										
											2013-07-24 17:52:09 -04:00
										 |  |  |     [ relayout ] | 
					
						
							|  |  |  |     [ find-world [ dup pref-dim resize-window ] when* ] bi ;
 | 
					
						
							| 
									
										
										
										
											2012-09-08 08:33:22 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 16:54:10 -04:00
										 |  |  | : with-ui ( quot: ( -- ) -- )
 | 
					
						
							| 
									
										
										
										
											2009-03-16 04:01:47 -04:00
										 |  |  |     ui-running? [ call( -- ) ] [ '[ init-ui @ ] (with-ui) ] if ;
 | 
					
						
							| 
									
										
										
										
											2009-01-08 18:02:54 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-10 13:29:07 -04:00
										 |  |  | HOOK: beep ui-backend ( -- )
 | 
					
						
							| 
									
										
										
										
											2010-01-15 19:55:43 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-23 22:28:57 -05:00
										 |  |  | HOOK: system-alert ui-backend ( caption text -- )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-16 15:18:50 -05:00
										 |  |  | : parse-main-window-attributes ( class -- attributes )
 | 
					
						
							|  |  |  |     "{" expect dup all-slots parse-tuple-literal-slots ;
 | 
					
						
							| 
									
										
										
										
											2010-01-15 19:55:43 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : define-main-window ( word attributes quot -- )
 | 
					
						
							|  |  |  |     [ | 
					
						
							| 
									
										
										
										
											2011-10-18 16:18:42 -04:00
										 |  |  |         '[ [ f _ clone @ open-window ] with-ui ] ( -- ) define-declared | 
					
						
							| 
									
										
										
										
											2010-05-05 16:52:54 -04:00
										 |  |  |     ] [ 2drop current-vocab main<< ] 3bi ;
 | 
					
						
							| 
									
										
										
										
											2010-01-15 19:55:43 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | SYNTAX: MAIN-WINDOW: | 
					
						
							| 
									
										
										
										
											2011-09-27 16:20:07 -04:00
										 |  |  |     scan-new-word | 
					
						
							| 
									
										
										
										
											2010-01-16 15:18:50 -05:00
										 |  |  |     world-attributes parse-main-window-attributes | 
					
						
							|  |  |  |     parse-definition | 
					
						
							|  |  |  |     define-main-window ;
 |