2009-01-06 21:55:23 -05:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2017-10-25 19:16:53 -04:00
|
|
|
USING: accessors classes combinators.short-circuit kernel ui
|
|
|
|
ui.gadgets ui.gadgets.borders ui.gadgets.scrollers
|
|
|
|
ui.gadgets.tracks ui.pens.solid ui.theme words ;
|
|
|
|
|
2009-01-06 21:55:23 -05:00
|
|
|
IN: ui.tools.common
|
|
|
|
|
2016-07-29 18:41:30 -04:00
|
|
|
: set-tool-dim ( class dim -- )
|
|
|
|
"tool-dim" set-word-prop ;
|
2014-04-28 16:01:18 -04:00
|
|
|
|
|
|
|
: get-tool-dim ( class -- dim )
|
2016-07-29 18:41:30 -04:00
|
|
|
"tool-dim" word-prop ;
|
2014-04-28 16:01:18 -04:00
|
|
|
|
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 ]
|
2017-10-25 19:16:53 -04:00
|
|
|
[
|
|
|
|
dup fullscreen? [ drop ] [
|
|
|
|
[ class-of ] [ dim>> ] bi set-tool-dim
|
|
|
|
] if
|
|
|
|
] bi ;
|
2009-01-08 19:35:34 -05:00
|
|
|
|
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
|
|
|
|
2016-07-29 18:41:30 -04:00
|
|
|
: margins ( child -- border )
|
2015-07-19 16:29:47 -04:00
|
|
|
{ 9 9 } <filled-border> ;
|
2015-07-24 10:22:47 -04:00
|
|
|
|
|
|
|
: with-lines ( track -- track )
|
2016-05-15 13:44:29 -04:00
|
|
|
dup orientation>> >>gap
|
2015-07-24 10:22:47 -04:00
|
|
|
line-color <solid> >>interior ;
|
2015-07-30 13:43:32 -04:00
|
|
|
|
|
|
|
: white-interior ( track -- track )
|
|
|
|
content-background <solid> >>interior ;
|