pub fn build_partial(mut self, layout: &FlexboxLayout) -> Result<(), NwgError> {
        if self.layout.base.is_null() {
            return Err(NwgError::layout_create("Flexboxlayout does not have a parent."));
        }

        // Auto compute size if enabled
        if self.auto_size {
            let children_count = self.layout.children.len();
            let size = 1.0f32 / (children_count as f32);
            for child in self.layout.children.iter_mut() {               
                let child_size = match &self.layout.style.flex_direction {
                    FlexDirection::Row | FlexDirection::RowReverse => {
                        Size { width: Dimension::Percent(size), height: Dimension::Auto }
                    },
                    FlexDirection::Column | FlexDirection::ColumnReverse => {
                        Size { width: Dimension::Auto, height: Dimension::Percent(size) }
                    }
                };

                child.modify_style(|s| s.size = child_size);
            }
        }

        // Auto spacing if enabled
        if let Some(spacing) = self.auto_spacing {
            let spacing = Dimension::Points(spacing as f32);
            let spacing = Rect { start: spacing, end: spacing, top: spacing, bottom: spacing};
            self.layout.style.padding = spacing;
            for child in self.layout.children.iter_mut() {
                child.modify_style(|s| s.margin = spacing);
            }
        }

        // Saves the new layout. Free the old layout (if there is one)
        {
            let mut layout_inner = layout.inner.borrow_mut();
            if layout_inner.handler.is_some() {
                drop(unbind_raw_event_handler(layout_inner.handler.as_ref().unwrap()));
            }
            
            *layout_inner = self.layout;        
        }

        Ok(())
    }
/// Build a "partial" layout object - this layout has no direct callback and needs to be added to a parent layout using child_layout
Build a "partial" layout object - this layout has no direct callback and needs to be added to a parent layout using child_layout
Build a " partial " layout object - this layout has no direct callback and needs to be added to a parent layout using child_layout
pub fn build_partial(mut self, layout: &FlexboxLayout) -> Result<(), NwgError> {
        if self.layout.base.is_null() {
            return Err(NwgError::layout_create("Flexboxlayout does not have a parent."));
        }
        // Auto compute size if enabled
        if self.auto_size {
            let children_count = self.layout.children.len();
            let size = 1.0f32 / (children_count as f32);
            for child in self.layout.children.iter_mut() {               
                let child_size = match &self.layout.style.flex_direction {
                    FlexDirection::Row | FlexDirection::RowReverse => {
                        Size { width: Dimension::Percent(size), height: Dimension::Auto }
                    },
                    FlexDirection::Column | FlexDirection::ColumnReverse => {
                        Size { width: Dimension::Auto, height: Dimension::Percent(size) }
                    }
                };
                child.modify_style(|s| s.size = child_size);
            }
        }
        // Auto spacing if enabled
        if let Some(spacing) = self.auto_spacing {
            let spacing = Dimension::Points(spacing as f32);
            let spacing = Rect { start: spacing, end: spacing, top: spacing, bottom: spacing};
            self.layout.style.padding = spacing;
            for child in self.layout.children.iter_mut() {
                child.modify_style(|s| s.margin = spacing);
            }
        }
        // Saves the new layout. Free the old layout (if there is one)
        {
            let mut layout_inner = layout.inner.borrow_mut();
            if layout_inner.handler.is_some() {
                drop(unbind_raw_event_handler(layout_inner.handler.as_ref().unwrap()));
            }
            *layout_inner = self.layout;        
        }
        Ok(())
    }
pub fn build_partial ( mut self , layout : & FlexboxLayout ) -> Result < ( ) , NwgError > { if self . layout . base . is_null ( ) { return Err ( NwgError :: layout_create ( " " ) ) ; } // Auto compute size if enabled if self . auto_size { let children_count = self . layout . children . len ( ) ; let size = 1.0f32 / ( children_count as f32 ) ; for child in self . layout . children . iter_mut ( ) { let child_size = match & self . layout . style . flex_direction { FlexDirection :: Row | FlexDirection :: RowReverse => { Size { width : Dimension :: Percent ( size ) , height : Dimension :: Auto } } , FlexDirection :: Column | FlexDirection :: ColumnReverse => { Size { width : Dimension :: Auto , height : Dimension :: Percent ( size ) } } } ; child . modify_style ( | s | s . size = child_size ) ; } } // Auto spacing if enabled if let Some ( spacing ) = self . auto_spacing { let spacing = Dimension :: Points ( spacing as f32 ) ; let spacing = Rect { start : spacing , end : spacing , top : spacing , bottom : spacing } ; self . layout . style . padding = spacing ; for child in self . layout . children . iter_mut ( ) { child . modify_style ( | s | s . margin = spacing ) ; } } // Saves the new layout. Free the old layout (if there is one) { let mut layout_inner = layout . inner . borrow_mut ( ) ; if layout_inner . handler . is_some ( ) { drop ( unbind_raw_event_handler ( layout_inner . handler . as_ref ( ) . unwrap ( ) ) ) ; } * layout_inner = self . layout ; } Ok ( ( ) ) }
Build a "partial" layout object - this layout has no direct callback and needs to be added to a parent layout using child_layout
Build a " partial " layout object - this layout has no direct callback and needs to be added to a parent layout using child_layout
mut self
layout
&FlexboxLayout