mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
use TuiInput in handlers
This commit is contained in:
parent
d9535b707f
commit
5d00e9f284
11 changed files with 37 additions and 61 deletions
|
|
@ -23,7 +23,7 @@ pub trait Engine: Send + Sync + Sized {
|
|||
pub trait Input<E: Engine> {
|
||||
type Event;
|
||||
fn event (&self)
|
||||
-> Self::Event;
|
||||
-> &Self::Event;
|
||||
fn is_done (&self)
|
||||
-> bool;
|
||||
fn done (&self);
|
||||
|
|
@ -427,35 +427,6 @@ impl<E: Engine, T: Widget<Engine = E>> Widget for Align<T> {
|
|||
type Engine = E;
|
||||
fn layout (&self, outer_area: E::Size) -> Perhaps<E::Size> {
|
||||
self.inner().layout(outer_area)
|
||||
//Ok(match self {
|
||||
//Self::Center(_) => self.inner().layout(outer_area)?.map(|inner_area|{
|
||||
//let [_, _, w, h] = inner_area.xywh();
|
||||
//let offset_x = (outer_area.w() / 2.into()) - (w / 2.into());
|
||||
//let offset_y = (outer_area.h() / 2.into()) - (h / 2.into());
|
||||
//let result = [outer_area.x() + offset_x, outer_area.y() + offset_y, w, h];
|
||||
//result.into()
|
||||
//}),
|
||||
//Self::X(_) => self.inner().layout(outer_area)?.map(|inner_area|{
|
||||
//let [_, y, w, h] = inner_area.xywh();
|
||||
//let offset_x = (outer_area.w() - w) / 2.into();
|
||||
//let result = [outer_area.x() + offset_x, y, w, h];
|
||||
//result.into(
|
||||
//}),
|
||||
//Self::Y(_) => self.inner().layout(outer_area)?.map(|inner_area|{
|
||||
//let [x, _, w, h] = inner_area.xywh();
|
||||
//let offset_y = (outer_area.h() / 2.into()) - (h / 2.into());
|
||||
//let result = [x, outer_area.y() + offset_y, w, h];
|
||||
//result.into()
|
||||
//}),
|
||||
//Self::NW(_) => { todo!() },
|
||||
//Self::N(_) => { todo!() },
|
||||
//Self::NE(_) => { todo!() },
|
||||
//Self::W(_) => { todo!() },
|
||||
//Self::E(_) => { todo!() },
|
||||
//Self::SW(_) => { todo!() },
|
||||
//Self::S(_) => { todo!() },
|
||||
//Self::SE(_) => { todo!() },
|
||||
//})
|
||||
}
|
||||
fn render (&self, to: &mut E::Output) -> Perhaps<E::Area> {
|
||||
let outer_area = to.area();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue