use iris::prelude::*; use winit::event::WindowEvent; fn main() { DefaultApp::::run(); } /// The tabs example: five demo panes plus a message composer, built by /// `tabs_ui::build` and driven here through the winit backend. The same /// widget tree also runs on the android-view backend, through /// `iris-android-app` -- see RUST.md's I2. #[derive(DefaultUiState)] pub struct Client { ui_state: DefaultUiState, info: WeakWidget, } impl DefaultAppState for Client { fn new( mut ui_state: DefaultUiState, rsc: &mut DefaultRsc, _: Proxy, ) -> Self { let widgets = tabs_ui::build(rsc, &mut ui_state); Self { ui_state, info: widgets.info, } } fn window_event( &mut self, _: WindowEvent, rsc: &mut DefaultRsc, render: &mut UiRenderState, ) { let new = format!( "widgets: {}\nactive: {}\nviews: {}", rsc.widgets().len(), render.active_widgets(), self.ui_state.renderer.ui.view_count(), ); if new != *rsc.widgets()[self.info].content { *rsc.widgets_mut()[self.info].content = new; } } }