factor/library/ui/tools/apropos.factor

37 lines
1.0 KiB
Factor
Raw Normal View History

2006-06-07 23:51:28 -04:00
! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2006-05-18 22:01:38 -04:00
IN: gadgets-apropos
2006-06-07 23:51:28 -04:00
USING: gadgets gadgets-editors gadgets-frames gadgets-labels
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
2006-05-26 17:40:41 -04:00
: apropos-gadget-pane ( apropos -- pane )
2006-05-19 22:29:01 -04:00
apropos-gadget-scroller scroller-gadget ;
2006-05-18 22:01:38 -04:00
2006-05-26 17:40:41 -04:00
: <apropos-prompt> ( -- gadget )
"" <editor> dup faint-boundary ;
2006-05-18 22:01:38 -04:00
2006-05-26 17:40:41 -04:00
: show-apropos ( apropos -- )
dup apropos-gadget-input commit-editor-text
swap apropos-gadget-pane [ apropos ] with-pane ;
2006-05-18 22:01:38 -04:00
2006-05-26 17:40:41 -04:00
M: apropos-gadget gadget-gestures
drop H{
{ T{ key-down f f "RETURN" } [ show-apropos ] }
} ;
2006-05-19 22:29:01 -04:00
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 ;
2006-05-26 02:29:44 -04:00
M: apropos-gadget gadget-title drop "Apropos" ;