tengri/output/src/widget/widget_field.rs

25 lines
866 B
Rust

use crate::*;
pub struct FieldH<Theme, Label, Value>(pub Theme, pub Label, pub Value);
impl<O: Out, T, L: Draw<O>, V: Draw<O>> Layout<O> for FieldH<T, L, V> where Self: Content<O> {
fn layout (&self, to: O::Area) -> O::Area {
self.content().layout(to)
}
}
impl<O: Out, T, L: Draw<O>, V: Draw<O>> Draw<O> for FieldH<T, L, V> where Self: Content<O> {
fn draw (&self, to: &mut O) {
self.content().draw(to)
}
}
pub struct FieldV<Theme, Label, Value>(pub Theme, pub Label, pub Value);
impl<O: Out, T, L: Draw<O>, V: Draw<O>> Layout<O> for FieldV<T, L, V> where Self: Content<O> {
fn layout (&self, to: O::Area) -> O::Area {
self.content().layout(to)
}
}
impl<O: Out, T, L: Draw<O>, V: Draw<O>> Draw<O> for FieldV<T, L, V> where Self: Content<O> {
fn draw (&self, to: &mut O) {
self.content().draw(to)
}
}