zsui 0.3.0-alpha.2

Rust-first feature-gated native UI framework for Win32, AppKit, and Linux.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{
    command_protocol::CommandQueue,
    event_protocol::{LifecycleEvent, UiEvent},
    geometry::{ComponentId, LayoutInput, LayoutOutput},
    render_protocol::{Renderer, TextLayout},
};

pub trait Component {
    fn id(&self) -> ComponentId;

    fn lifecycle(&mut self, event: LifecycleEvent) {
        let _ = event;
    }

    fn update(&mut self, event: &UiEvent, commands: &mut CommandQueue);
    fn layout(&mut self, input: LayoutInput) -> LayoutOutput;
    fn render(&self, renderer: &mut dyn Renderer, text: &dyn TextLayout);
}