factor/library/ui/gadgets/viewports.factor

28 lines
682 B
Factor
Raw Normal View History

2006-05-24 03:23:45 -04:00
! Copyright (C) 2005, 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2006-05-26 02:29:44 -04:00
IN: gadgets-viewports
USING: arrays gadgets gadgets-borders generic kernel math
namespaces sequences ;
2006-05-24 03:23:45 -04:00
TUPLE: viewport ;
: find-viewport [ viewport? ] find-parent ;
: viewport-dim gadget-child pref-dim ;
C: viewport ( content -- viewport )
dup delegate>gadget
2006-08-04 00:01:18 -04:00
[ >r 3 <border> r> add-gadget ] keep
2006-06-23 02:25:08 -04:00
t over set-gadget-clipped? ;
2006-05-24 03:23:45 -04:00
M: viewport layout*
2006-07-19 19:30:02 -04:00
dup gadget-child dup pref-dim rot rect-dim vmax
swap set-layout-dim ;
2006-05-24 03:23:45 -04:00
M: viewport focusable-child*
2006-05-24 03:23:45 -04:00
gadget-child ;
M: viewport pref-dim* viewport-dim ;
2006-08-04 00:01:18 -04:00
: viewport-rect ( rect -- rect ) { 3 3 } offset-rect ;