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.
37 lines
664 B
Rust
37 lines
664 B
Rust
use uwui_dsl::NativeComponent;
|
|
|
|
use crate::backend::Backend;
|
|
use crate::layout::Gravity;
|
|
use crate::view::{NativeComponent, NewNative};
|
|
|
|
#[derive(NativeComponent)]
|
|
pub struct Text {
|
|
params: TextParams,
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct TextParams {
|
|
pub content: String,
|
|
pub gravity: Gravity,
|
|
}
|
|
|
|
impl From<(String,)> for TextParams {
|
|
fn from(value: (String,)) -> Self {
|
|
Self {
|
|
content: value.0,
|
|
..Default::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<B: Backend> NewNative<B> for Text
|
|
where
|
|
Text: NativeComponent<B>,
|
|
{
|
|
type Params = TextParams;
|
|
|
|
fn new(params: Self::Params) -> Self {
|
|
Self { params }
|
|
}
|
|
}
|