add functions for accessing the current selection

This commit is contained in:
eknauel 2005-05-25 13:48:17 +00:00
parent cbf39ba61e
commit 6ef959883f
2 changed files with 13 additions and 1 deletions

View File

@ -121,7 +121,9 @@
move-cursor-up move-cursor-up
move-cursor-down move-cursor-down
paint-selection-list 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 (define-structure select-list select-list-interface
(open scheme (open scheme

View File

@ -172,3 +172,13 @@
(else (else
(mvwaddstr win y x (element-text (car elts))) (mvwaddstr win y x (element-text (car elts)))
(lp (cdr elts) (+ y 1) (+ i 1)))))))) (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))))