added buttons for book navigation

db4
Sam Anklesaria 2009-03-09 20:35:49 -05:00
parent 4d453923ae
commit 895b1339f8
1 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,11 @@
USING: accessors kernel fry math models ui.gadgets ui.gadgets.books ui.gadgets.buttons ;
IN: ui.gadgets.book-extras
: <book*> ( pages -- book ) 0 <model> <book> ;
: |<< ( book -- ) 0 swap set-control-value ;
: next ( book -- ) model>> [ 1 + ] change-model ;
: prev ( book -- ) model>> [ 1 - ] change-model ;
: (book-t) ( quot -- quot ) '[ : owner ( gadget -- book ) parent>> dup book? [ owner ] unless ; owner @ ] ;
: <book-btn> ( label quot -- button ) (book-t) <button> ;
: <book-bevel-btn> ( label quot -- button ) (book-t) <bevel-button> ;
: >>> ( label -- button ) [ next ] <book-btn> ;
: <<< ( label -- button ) [ prev ] <book-btn> ;