If the control is visible
(&self, visible: bool)
| 471 | |
| 472 | /// If the control is visible |
| 473 | fn set_visible(&self, visible: bool) { |
| 474 | let mut comp = self.as_ref().borrow_mut(); |
| 475 | |
| 476 | assert!( |
| 477 | !comp.destroyed, |
| 478 | "Widget was already destroyed but is being interacted with" |
| 479 | ); |
| 480 | |
| 481 | comp.visible = visible; |
| 482 | if comp.update_vis_state { |
| 483 | comp.vis_state = visible; |
| 484 | } |
| 485 | |
| 486 | if comp.onvisible.is_some() { |
| 487 | let visible = comp.visible; |
| 488 | let _ = comp.onvisible.get().try_send(visible); |
| 489 | } |
| 490 | |
| 491 | // for child in comp.children.iter() { |
| 492 | // if let Some(widget) = child.widget() { |
| 493 | // widget.set_visible_only(comp.visible && widget.vis_state()); |
| 494 | // } |
| 495 | // } |
| 496 | |
| 497 | if let Some(widget) = comp.canvas.as_mut() { |
| 498 | widget.focus_invalid = true; |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | // ?_from:WidgetComponent = None |
| 503 | fn find_top_parent(&self, from: Option<&WidgetComponent>) -> Option<WidgetComponent> { |
no test coverage detected