the parent control, None if no parent
(&self, p: Option<Id>)
| 1589 | |
| 1590 | //the parent control, None if no parent |
| 1591 | fn set_parent(&self, p: Option<Id>) { |
| 1592 | let mut comp = self.as_ref().borrow_mut(); |
| 1593 | |
| 1594 | assert!( |
| 1595 | !comp.destroyed, |
| 1596 | "Widget was already destroyed but is being interacted with" |
| 1597 | ); |
| 1598 | |
| 1599 | //do stuff with old parent |
| 1600 | |
| 1601 | comp.parent = p; |
| 1602 | |
| 1603 | if let Some(parent) = comp.parent { |
| 1604 | // if let Some(widget) = parent.widget() { |
| 1605 | // comp.ignore_spatial = true; |
| 1606 | // comp.x = widget.x() + comp.x_local; |
| 1607 | // comp.y = widget.y() + comp.y_local; |
| 1608 | // comp.ignore_spatial = false; |
| 1609 | // } |
| 1610 | } |
| 1611 | } |
| 1612 | |
| 1613 | #[inline] |
| 1614 | //the parent control, None if no parent |
no test coverage detected