]> gitweb.factorcode.org Git - factor.git/blob - extra/ui/gadgets/book-extras/book-extras.factor
b9d859962fb806ed9594fd3e8509f3dacc2caa24
[factor.git] / extra / ui / gadgets / book-extras / book-extras.factor
1 USING: accessors kernel fry math models ui.gadgets ui.gadgets.books ui.gadgets.buttons ;
2 IN: ui.gadgets.book-extras
3 : <book*> ( pages -- book ) 0 <model> <book> ;
4 : |<< ( book -- ) 0 swap set-control-value ;
5 : next ( book -- ) model>> [ 1 + ] change-model ;
6 : prev ( book -- ) model>> [ 1 - ] change-model ;
7 : (book-t) ( quot -- quot ) '[ : owner ( gadget -- book ) parent>> dup book? [ owner ] unless ; owner @ ] ;
8 : <book-btn> ( label quot -- button ) (book-t) <button> ;
9 : <book-bevel-btn> ( label quot -- button ) (book-t) <border-button> ;
10 : >>> ( label -- button ) [ next ] <book-btn> ;
11 : <<< ( label -- button ) [ prev ] <book-btn> ;