ui.gadgets.tracks: remove 'make-track'
parent
8782ef8c5f
commit
7aa66d2f5c
|
@ -10,7 +10,6 @@ ARTICLE: "ui-track-layout" "Track layouts"
|
||||||
"Adding children:"
|
"Adding children:"
|
||||||
{ $subsection track-add }
|
{ $subsection track-add }
|
||||||
"Creating new tracks using a combinator:"
|
"Creating new tracks using a combinator:"
|
||||||
{ $subsection make-track }
|
|
||||||
{ $subsection track, } ;
|
{ $subsection track, } ;
|
||||||
|
|
||||||
HELP: track
|
HELP: track
|
||||||
|
@ -20,18 +19,12 @@ HELP: <track>
|
||||||
{ $values { "orientation" "an orientation specifier" } { "track" "a new " { $link 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 }" } "." } ;
|
{ $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
|
HELP: track-add
|
||||||
{ $values { "gadget" gadget } { "track" track } { "constraint" "a number between 0 and 1, or " { $link f } } }
|
{ $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." } ;
|
{ $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,
|
HELP: track,
|
||||||
{ $values { "gadget" gadget } { "constraint" "a number between 0 and 1, or " { $link f } } }
|
{ $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 } "." } ;
|
{ $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: 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." } ;
|
|
||||||
|
|
||||||
ABOUT: "ui-track-layout"
|
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
|
IN: ui.gadgets.tracks.tests
|
||||||
|
|
||||||
[ { 100 100 } ] [
|
[ { 100 100 } ] [
|
||||||
[
|
{ 0 1 } <track>
|
||||||
<gadget> { 100 100 } over set-rect-dim 1 track,
|
<gadget> { 100 100 } >>dim 1 track-add*
|
||||||
] { 0 1 } make-track pref-dim
|
pref-dim
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ { 100 110 } ] [
|
[ { 100 110 } ] [
|
||||||
[
|
{ 0 1 } <track>
|
||||||
<gadget> { 10 10 } over set-rect-dim f track,
|
<gadget> { 10 10 } >>dim f track-add*
|
||||||
<gadget> { 100 100 } over set-rect-dim 1 track,
|
<gadget> { 100 100 } >>dim 1 track-add*
|
||||||
] { 0 1 } make-track pref-dim
|
pref-dim
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -56,9 +56,6 @@ M: track pref-dim*
|
||||||
: track, ( gadget constraint -- )
|
: track, ( gadget constraint -- )
|
||||||
gadget get swap track-add ;
|
gadget get swap track-add ;
|
||||||
|
|
||||||
: make-track ( quot orientation -- track )
|
|
||||||
<track> swap make-gadget ; inline
|
|
||||||
|
|
||||||
: track-remove ( gadget track -- )
|
: track-remove ( gadget track -- )
|
||||||
over [
|
over [
|
||||||
[ gadget-children index ] 2keep
|
[ gadget-children index ] 2keep
|
||||||
|
|
Loading…
Reference in New Issue