2009-01-06 21:55:23 -05:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-01-08 19:35:34 -05:00
|
|
|
USING: accessors assocs classes classes.mixin kernel namespaces
|
2015-07-30 13:43:32 -04:00
|
|
|
parser ui.gadgets ui.gadgets.borders
|
|
|
|
ui.pens.solid ui.gadgets.scrollers ui.gadgets.tracks ui.gadgets.theme
|
2009-02-16 05:34:22 -05:00
|
|
|
combinators.short-circuit ;
|
2009-01-06 21:55:23 -05:00
|
|
|
IN: ui.tools.common
|
|
|
|
|
2009-01-08 19:35:34 -05:00
|
|
|
SYMBOL: tool-dims
|
|
|
|
|
2009-04-30 22:38:14 -04:00
|
|
|
tool-dims [ H{ } clone ] initialize
|
2009-01-08 19:35:34 -05:00
|
|
|
|
2014-04-28 16:01:18 -04:00
|
|
|
: set-tool-dim ( dim class -- )
|
|
|
|
tool-dims get-global set-at ;
|
|
|
|
|
|
|
|
: get-tool-dim ( class -- dim )
|
|
|
|
tool-dims get-global at ;
|
|
|
|
|
2009-01-08 19:56:39 -05:00
|
|
|
TUPLE: tool < track ;
|
2009-01-08 19:35:34 -05:00
|
|
|
|
|
|
|
M: tool pref-dim*
|
2014-04-28 16:01:18 -04:00
|
|
|
{ [ class-of get-tool-dim ] [ call-next-method ] } 1|| ;
|
2009-01-08 19:35:34 -05:00
|
|
|
|
|
|
|
M: tool layout*
|
|
|
|
[ call-next-method ]
|
2014-04-28 16:01:18 -04:00
|
|
|
[ [ dim>> ] [ class-of ] bi set-tool-dim ]
|
2009-01-08 19:35:34 -05:00
|
|
|
bi ;
|
|
|
|
|
2009-01-07 16:21:51 -05:00
|
|
|
SLOT: scroller
|
|
|
|
|
2009-01-06 21:55:23 -05:00
|
|
|
: com-page-up ( tool -- )
|
|
|
|
scroller>> scroll-up-page ;
|
|
|
|
|
|
|
|
: com-page-down ( tool -- )
|
|
|
|
scroller>> scroll-down-page ;
|
|
|
|
|
|
|
|
: com-scroll-up ( tool -- )
|
|
|
|
scroller>> scroll-up-line ;
|
|
|
|
|
|
|
|
: com-scroll-down ( tool -- )
|
|
|
|
scroller>> scroll-down-line ;
|
2015-07-19 16:29:47 -04:00
|
|
|
|
|
|
|
: margins ( child -- border )
|
|
|
|
{ 9 9 } <filled-border> ;
|
2015-07-24 10:22:47 -04:00
|
|
|
|
|
|
|
: with-lines ( track -- track )
|
|
|
|
dup orientation>> >>gap
|
|
|
|
line-color <solid> >>interior ;
|
2015-07-30 13:43:32 -04:00
|
|
|
|
|
|
|
: white-interior ( track -- track )
|
|
|
|
content-background <solid> >>interior ;
|