ui.gadgets.tracks: remove 'make-track'
parent
8782ef8c5f
commit
7aa66d2f5c
|
@ -10,7 +10,6 @@ ARTICLE: "ui-track-layout" "Track layouts"
|
|||
"Adding children:"
|
||||
{ $subsection track-add }
|
||||
"Creating new tracks using a combinator:"
|
||||
{ $subsection make-track }
|
||||
{ $subsection track, } ;
|
||||
|
||||
HELP: track
|
||||
|
@ -20,18 +19,12 @@ HELP: <track>
|
|||
{ $values { "orientation" "an orientation specifier" } { "track" "a new " { $link track } } }
|
||||
{ $description "Creates a new track which lays out children along the given axis. Children are laid out vertically if the orientation is " { $snippet "{ 0 1 }" } " and horizontally if the orientation is " { $snippet "{ 1 0 }" } "." } ;
|
||||
|
||||
{ <track> make-track } related-words
|
||||
|
||||
HELP: track-add
|
||||
{ $values { "gadget" gadget } { "track" track } { "constraint" "a number between 0 and 1, or " { $link f } } }
|
||||
{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the constrant is a fraction of the total size which is allocated for the child." } ;
|
||||
|
||||
HELP: track,
|
||||
{ $values { "gadget" gadget } { "constraint" "a number between 0 and 1, or " { $link f } } }
|
||||
{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the constrant is a fraction of the total size which is allocated for the child. This word can only be called inside the quotation passed to " { $link make-track } "." } ;
|
||||
|
||||
HELP: make-track
|
||||
{ $values { "quot" quotation } { "orientation" "an orientation specifier" } { "track" track } }
|
||||
{ $description "Creates a new track. The quotation can add children by calling the " { $link track, } " word." } ;
|
||||
{ $description "Adds a new child to a track. If the constraint is " { $link f } ", the child always occupies its preferred size. Otherwise, the constrant is a fraction of the total size which is allocated for the child." } ;
|
||||
|
||||
ABOUT: "ui-track-layout"
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
USING: kernel ui.gadgets ui.gadgets.tracks tools.test math.geometry.rect ;
|
||||
USING: kernel ui.gadgets ui.gadgets.tracks tools.test
|
||||
math.geometry.rect accessors ;
|
||||
IN: ui.gadgets.tracks.tests
|
||||
|
||||
[ { 100 100 } ] [
|
||||
[
|
||||
<gadget> { 100 100 } over set-rect-dim 1 track,
|
||||
] { 0 1 } make-track pref-dim
|
||||
{ 0 1 } <track>
|
||||
<gadget> { 100 100 } >>dim 1 track-add*
|
||||
pref-dim
|
||||
] unit-test
|
||||
|
||||
[ { 100 110 } ] [
|
||||
[
|
||||
<gadget> { 10 10 } over set-rect-dim f track,
|
||||
<gadget> { 100 100 } over set-rect-dim 1 track,
|
||||
] { 0 1 } make-track pref-dim
|
||||
{ 0 1 } <track>
|
||||
<gadget> { 10 10 } >>dim f track-add*
|
||||
<gadget> { 100 100 } >>dim 1 track-add*
|
||||
pref-dim
|
||||
] unit-test
|
||||
|
|
|
@ -56,9 +56,6 @@ M: track pref-dim*
|
|||
: track, ( gadget constraint -- )
|
||||
gadget get swap track-add ;
|
||||
|
||||
: make-track ( quot orientation -- track )
|
||||
<track> swap make-gadget ; inline
|
||||
|
||||
: track-remove ( gadget track -- )
|
||||
over [
|
||||
[ gadget-children index ] 2keep
|
||||
|
|
Loading…
Reference in New Issue