44 lines
1003 B
Rust
44 lines
1003 B
Rust
use iris::prelude::*;
|
|
use winit::event::WindowEvent;
|
|
|
|
fn main() {
|
|
DefaultApp::<Client>::run();
|
|
}
|
|
|
|
#[derive(DefaultUiState)]
|
|
pub struct Client {
|
|
ui_state: DefaultUiState,
|
|
info: WeakWidget<Text>,
|
|
}
|
|
|
|
impl DefaultAppState for Client {
|
|
fn new(
|
|
mut ui_state: DefaultUiState,
|
|
rsc: &mut DefaultRsc<Self>,
|
|
_: Proxy<Self::Event>,
|
|
) -> 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<Self>,
|
|
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;
|
|
}
|
|
}
|
|
}
|