! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: gadgets-browser USING: arrays gadgets gadgets-buttons gadgets-labels gadgets-layouts gadgets-panes gadgets-scrolling gadgets-theme generic hashtables help inspector kernel math namespaces prettyprint sequences words ; SYMBOL: components H{ } clone components set-global : get-components ( class -- assoc ) components get-global hash [ { { "Slots" [ describe ] } } ] unless* ; { { "Definition" [ help ] } { "Calls in" [ usage. ] } { "Calls out" [ uses. ] } { "Links in" [ links-in. ] } { "Links out" [ links-out. ] } { "Vocabulary" [ word-vocabulary words. ] } { "Properties" [ word-props describe ] } } \ word components get-global set-hash { { "Article" [ help ] } { "Links in" [ links-in. ] } { "Links out" [ links-out. ] } } \ link components get-global set-hash { { "Call stack" [ continuation-call callstack. ] } { "Data stack" [ continuation-data stack. ] } { "Retain stack" [ continuation-retain stack. ] } { "Name stack" [ continuation-name stack. ] } { "Catch stack" [ continuation-catch stack. ] } } \ continuation components get-global set-hash TUPLE: book page pages ; : show-page ( key book -- ) dup book-page unparent [ book-pages assoc ] keep [ set-book-page ] 2keep add-gadget ; C: book ( pages -- book ) dup delegate>gadget [ set-book-pages ] 2keep [ >r first first r> show-page ] keep ; M: book pref-dim* ( book -- dim ) book-page pref-dim ; M: book layout* ( book -- ) dup rect-dim swap book-page set-gadget-dim ; : component-pages ( obj -- assoc ) dup class get-components [ first2 swapd make-pane 2array ] map-with ; : ( name book -- button ) dupd [ show-page drop ] curry curry >r