You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
836 B
Rust

pub mod backend;
pub mod layout;
pub mod view;
pub mod widget;
pub use uwui_dsl::{template, CustomComponent, NativeComponent};
use layout::Gravity;
use view::{Construct, GetTemplate, Template};
use widget::{Button, Text, VStack};
fn asdf() -> Template {
template! {
VStack(Gravity::Center) {
MyComponent(x: 420)
Button(label: "don't click me")
}
}
}
#[derive(Default)]
struct MyParams {
x: i32,
}
#[derive(CustomComponent)]
struct MyComponent {
params: MyParams,
}
impl Construct for MyComponent {
type Params = MyParams;
fn construct(params: Self::Params) -> Self {
Self { params }
}
}
impl GetTemplate for MyComponent {
fn get_template(&self) -> Template {
template! {
Text(format!("x = {}", self.params.x))
}
}
}