factor/library/ui/tools/help.factor

38 lines
1.1 KiB
Factor
Raw Normal View History

! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: gadgets-help
2006-07-06 18:08:14 -04:00
USING: gadgets gadgets-borders gadgets-buttons gadgets-frames
2006-08-24 22:44:42 -04:00
gadgets-panes gadgets-search
2006-07-06 18:08:14 -04:00
gadgets-scrolling help kernel models namespaces sequences ;
2006-07-01 16:07:10 -04:00
TUPLE: help-gadget history ;
: show-help ( link help -- )
2006-07-01 16:07:10 -04:00
dup help-gadget-history add-history
2006-07-05 17:12:30 -04:00
help-gadget-history set-model ;
2006-06-29 03:54:30 -04:00
: go-home ( help -- ) "handbook" swap show-help ;
2006-08-24 18:23:48 -04:00
help-gadget {
{ f "Back" T{ key-down f f "b" } [ help-gadget-history go-back ] }
{ f "Forward" T{ key-down f f "f" } [ help-gadget-history go-forward ] }
{ f "Home" T{ key-down f f "h" } [ go-home ] }
} define-commands
2006-06-29 03:54:30 -04:00
: <help-pane> ( -- gadget )
2006-07-01 16:07:10 -04:00
gadget get help-gadget-history [ help ] <pane-control> ;
2006-06-29 03:54:30 -04:00
C: help-gadget ( -- gadget )
2006-08-26 14:30:58 -04:00
T{ link f "handbook" } <history>
over set-help-gadget-history {
2006-06-29 03:54:30 -04:00
{ [ <help-pane> <scroller> ] f f @center }
} make-frame* ;
M: help-gadget gadget-title
2006-07-05 17:12:30 -04:00
help-gadget-history
[ "Help - " swap article-title append ] <filter> ;
2006-08-24 18:23:48 -04:00
: help-tool [ help-gadget? ] [ <help-gadget> ] [ show-help ] ;
2006-08-25 20:52:13 -04:00
link 1 "Browse" [ help-tool call-tool ] define-operation