| 
									
										
										
										
											2009-02-16 00:14:18 -05:00
										 |  |  | ! Copyright (C) 2005, 2009 Slava Pestov. | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2009-02-16 00:14:18 -05:00
										 |  |  | USING: arrays accessors definitions hashtables io kernel sequences | 
					
						
							| 
									
										
										
										
											2009-05-11 17:18:47 -04:00
										 |  |  | strings words math models namespaces quotations ui.gadgets | 
					
						
							| 
									
										
										
										
											2009-02-16 00:14:18 -05:00
										 |  |  | ui.gadgets.borders ui.gadgets.buttons ui.gadgets.buttons.private | 
					
						
							| 
									
										
										
										
											2008-07-11 01:01:22 -04:00
										 |  |  | ui.gadgets.labels ui.gadgets.menus ui.gadgets.worlds | 
					
						
							|  |  |  | ui.gadgets.status-bar ui.commands ui.operations ui.gestures ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | IN: ui.gadgets.presentations | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-10 21:32:17 -04:00
										 |  |  | TUPLE: presentation < button object hook ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : invoke-presentation ( presentation command -- )
 | 
					
						
							| 
									
										
										
										
											2009-04-12 17:08:54 -04:00
										 |  |  |     [ [ dup hook>> call( presentation -- ) ] [ object>> ] bi ] dip
 | 
					
						
							| 
									
										
										
										
											2008-12-19 00:56:41 -05:00
										 |  |  |     invoke-command ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : invoke-primary ( presentation -- )
 | 
					
						
							| 
									
										
										
										
											2008-08-31 02:42:30 -04:00
										 |  |  |     dup object>> primary-operation | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     invoke-presentation ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : invoke-secondary ( presentation -- )
 | 
					
						
							| 
									
										
										
										
											2008-08-31 02:42:30 -04:00
										 |  |  |     dup object>> secondary-operation | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     invoke-presentation ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : show-mouse-help ( presentation -- )
 | 
					
						
							| 
									
										
										
										
											2008-12-19 00:56:41 -05:00
										 |  |  |     [ [ object>> ] keep show-summary ] [ button-update ] bi ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : <presentation> ( label object -- button )
 | 
					
						
							| 
									
										
										
										
											2008-07-10 21:32:17 -04:00
										 |  |  |     swap [ invoke-primary ] presentation new-button | 
					
						
							|  |  |  |         swap >>object | 
					
						
							|  |  |  |         [ drop ] >>hook | 
					
						
							|  |  |  |         roll-button-theme ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | M: presentation ungraft* | 
					
						
							|  |  |  |     dup hand-gadget get-global child? [ dup hide-status ] when
 | 
					
						
							| 
									
										
										
										
											2008-07-10 21:32:17 -04:00
										 |  |  |     call-next-method ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-16 17:39:32 -05:00
										 |  |  | : show-presentation-menu ( presentation -- )
 | 
					
						
							| 
									
										
										
										
											2008-12-19 00:56:41 -05:00
										 |  |  |     [ ] [ object>> ] [ dup hook>> curry ] tri
 | 
					
						
							| 
									
										
										
										
											2009-01-16 17:39:32 -05:00
										 |  |  |     show-operations-menu ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | presentation H{ | 
					
						
							| 
									
										
										
										
											2009-01-16 17:39:32 -05:00
										 |  |  |     { T{ button-down f f 3 } [ show-presentation-menu ] } | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:57 -05:00
										 |  |  |     { mouse-leave [ [ hide-status ] [ button-update ] bi ] } | 
					
						
							|  |  |  |     { mouse-enter [ show-mouse-help ] } | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     ! Responding to motion too allows nested presentations to | 
					
						
							|  |  |  |     ! display status help properly, when the mouse leaves a | 
					
						
							|  |  |  |     ! nested presentation and is still inside the parent, the | 
					
						
							|  |  |  |     ! parent doesn't receive a mouse-enter | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:57 -05:00
										 |  |  |     { motion [ show-mouse-help ] } | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | } set-gestures |