diff options
| author | 2019-09-20 19:15:31 +0200 | |
|---|---|---|
| committer | 2019-09-20 19:15:31 +0200 | |
| commit | b9e0f7494881ad7cdfbcbc16878ecc6ef717753f (patch) | |
| tree | c8a7419b5cb4c0161306c479b93038f2f86498c2 /src/node.rs | |
| parent | b83a4b42dd912b5f59d40e7d4f7f7ccdabc43019 (diff) | |
| download | iced-b9e0f7494881ad7cdfbcbc16878ecc6ef717753f.tar.gz iced-b9e0f7494881ad7cdfbcbc16878ecc6ef717753f.tar.bz2 iced-b9e0f7494881ad7cdfbcbc16878ecc6ef717753f.zip  | |
Create `iced_core` and `iced_native`
Diffstat (limited to 'src/node.rs')
| -rw-r--r-- | src/node.rs | 60 | 
1 files changed, 0 insertions, 60 deletions
diff --git a/src/node.rs b/src/node.rs deleted file mode 100644 index 1db10d7f..00000000 --- a/src/node.rs +++ /dev/null @@ -1,60 +0,0 @@ -use stretch::node; - -use crate::{Number, Size, Style}; - -/// The visual requirements of a [`Widget`] and its children. -/// -/// When there have been changes and the [`Layout`] needs to be recomputed, the -/// runtime obtains a [`Node`] by calling [`Widget::node`]. -/// -/// [`Style`]: struct.Style.html -/// [`Widget`]: widget/trait.Widget.html -/// [`Node`]: struct.Node.html -/// [`Widget::node`]: widget/trait.Widget.html#tymethod.node -/// [`Layout`]: struct.Layout.html -#[derive(Debug)] -pub struct Node(pub(crate) node::Node); - -impl Node { -    /// Creates a new [`Node`] with the given [`Style`]. -    /// -    /// [`Node`]: struct.Node.html -    /// [`Style`]: struct.Style.html -    pub fn new(style: Style) -> Node { -        Self::with_children(style, Vec::new()) -    } - -    /// Creates a new [`Node`] with the given [`Style`] and a measure function. -    /// -    /// This type of node cannot have any children. -    /// -    /// You should use this when your [`Widget`] can adapt its contents to the -    /// size of its container. The measure function will receive the container -    /// size as a parameter and must compute the size of the [`Node`] inside -    /// the given bounds (if the `Number` for a dimension is `Undefined` it -    /// means that it has no boundary). -    /// -    /// [`Node`]: struct.Node.html -    /// [`Style`]: struct.Style.html -    /// [`Widget`]: widget/trait.Widget.html -    pub fn with_measure<F>(style: Style, measure: F) -> Node -    where -        F: 'static + Fn(Size<Number>) -> Size<f32>, -    { -        Node(node::Node::new_leaf( -            style.0, -            Box::new(move |size| Ok(measure(size))), -        )) -    } - -    /// Creates a new [`Node`] with the given [`Style`] and children. -    /// -    /// [`Node`]: struct.Node.html -    /// [`Style`]: struct.Style.html -    pub fn with_children(style: Style, children: Vec<Node>) -> Node { -        Node(node::Node::new( -            style.0, -            children.iter().map(|c| &c.0).collect(), -        )) -    } -}  | 
