use patina::{prelude::*, ui::UIControlMsg, window::WindowComponent}; struct SimpleWindow { widget: ::RootWidget, } impl SimpleWindow { fn new(uih: &mut patina::ui::UIHandle) -> Self { Self { widget: patina::widget::Frame::new(uih), } } } enum SimpleWindowMsg { Close, } impl Component for SimpleWindow { type ParentMsg = UIControlMsg; type Msg = SimpleWindowMsg; fn process(&mut self, msg: Self::Msg) -> Vec { match msg { SimpleWindowMsg::Close => vec![UIControlMsg::Terminate], } } } impl WindowComponent for SimpleWindow { fn map_window_event(&self, we: patina::window::WindowEvent) -> Option { match we { patina::window::WindowEvent::CloseRequested => Some(SimpleWindowMsg::Close), _ => None, } } type RootWidget = patina::widget::Frame; fn root_widget(&self) -> &Self::RootWidget { &self.widget } fn root_widget_mut(&mut self) -> &mut Self::RootWidget { &mut self.widget } } fn main() { patina::ui::make_opinionated_ui(SimpleWindow::new).run(); }