add functions for accessing the current selection
This commit is contained in:
		
							parent
							
								
									cbf39ba61e
								
							
						
					
					
						commit
						6ef959883f
					
				| 
						 | 
				
			
			@ -121,7 +121,9 @@
 | 
			
		|||
	  move-cursor-up
 | 
			
		||||
	  move-cursor-down
 | 
			
		||||
	  paint-selection-list
 | 
			
		||||
	  paint-selection-list-at))
 | 
			
		||||
	  paint-selection-list-at
 | 
			
		||||
	  select-list-get-selection
 | 
			
		||||
	  select-list-selected-entry))
 | 
			
		||||
 | 
			
		||||
(define-structure select-list select-list-interface
 | 
			
		||||
  (open scheme
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,3 +172,13 @@
 | 
			
		|||
	 (else
 | 
			
		||||
	  (mvwaddstr win y x (element-text (car elts)))
 | 
			
		||||
	  (lp (cdr elts) (+ y 1) (+ i 1))))))))
 | 
			
		||||
 | 
			
		||||
(define (select-list-get-selection select-list)
 | 
			
		||||
  (map element-value
 | 
			
		||||
       (filter-map element-marked? 
 | 
			
		||||
		   (select-list-elements select-list))))
 | 
			
		||||
 | 
			
		||||
(define (select-list-selected-entry select-list)
 | 
			
		||||
  (element-value
 | 
			
		||||
   (list-ref (select-list-elements select-list)
 | 
			
		||||
	     (select-list-cursor-index select-list))))
 | 
			
		||||
		Loading…
	
		Reference in New Issue