pub mod base;
#[cfg(feature = "docking")]
pub mod docking;
pub mod scroll_container;
pub mod scrollbar;
pub use base::*;
pub use scroll_container::*;
pub use scrollbar::*;
use crate::style::Style;
use crate::tree::NodeId;
use astrelis_core::math::Vec2;
use astrelis_text::FontRenderer;
use std::any::Any;
pub trait Widget: Any {
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
fn style(&self) -> &Style;
fn style_mut(&mut self) -> &mut Style;
fn children(&self) -> &[NodeId] {
&[]
}
fn children_mut(&mut self) -> Option<&mut Vec<NodeId>> {
None
}
fn measure(&self, _available_space: Vec2, _font_renderer: Option<&FontRenderer>) -> Vec2 {
Vec2::ZERO
}
fn clone_box(&self) -> Box<dyn Widget>;
}
impl Clone for Box<dyn Widget> {
fn clone(&self) -> Self {
self.clone_box()
}
}