factor/library/ui/apropos.factor

34 lines
930 B
Factor
Raw Normal View History

2006-05-18 22:01:38 -04:00
IN: gadgets-apropos
USING: gadgets gadgets-editors gadgets-labels gadgets-layouts
2006-05-18 22:28:32 -04:00
gadgets-panes gadgets-scrolling gadgets-theme generic inspector
kernel ;
2006-05-18 22:01:38 -04:00
2006-05-19 22:29:01 -04:00
TUPLE: apropos-gadget scroller input ;
2006-05-18 22:01:38 -04:00
: apropos-pane ( gadget -- pane )
2006-05-19 22:29:01 -04:00
[ apropos-gadget? ] find-parent
apropos-gadget-scroller scroller-gadget ;
2006-05-18 22:01:38 -04:00
: <prompt> ( quot -- editor )
"" <editor> [
swap T{ key-down f f "RETURN" } set-action
] keep ;
: show-apropos ( editor -- )
dup commit-editor-text
swap apropos-pane [ apropos ] with-pane ;
2006-05-19 22:29:01 -04:00
: <apropos-prompt> ( -- gadget )
[ show-apropos ] <prompt> dup faint-boundary ;
2006-05-18 22:01:38 -04:00
C: apropos-gadget ( -- )
2006-05-19 22:29:01 -04:00
{
{ [ <pane> <scroller> ] set-apropos-gadget-scroller @center }
{ [ <apropos-prompt> ] set-apropos-gadget-input @top }
} make-frame* ;
2006-05-18 22:01:38 -04:00
M: apropos-gadget pref-dim* drop { 350 200 0 } ;
M: apropos-gadget focusable-child* ( pane -- editor )
apropos-gadget-input ;