mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
down to 28e, sane ones
This commit is contained in:
parent
46609855eb
commit
16e6a0397c
15 changed files with 91 additions and 87 deletions
10
src/style.rs
10
src/style.rs
|
|
@ -23,7 +23,7 @@ impl TuiStyle for Tui {}
|
|||
pub struct Bold<W: Content<Tui>>(pub bool, W);
|
||||
|
||||
impl<W: Content<Tui>> Content<Tui> for Bold<W> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
Some(&self.1)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) {
|
||||
|
|
@ -35,7 +35,7 @@ impl<W: Content<Tui>> Content<Tui> for Bold<W> {
|
|||
pub struct Foreground<W: Content<Tui>>(pub Color, W);
|
||||
|
||||
impl<W: Content<Tui>> Content<Tui> for Foreground<W> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
Some(&self.1)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) {
|
||||
|
|
@ -47,7 +47,7 @@ impl<W: Content<Tui>> Content<Tui> for Foreground<W> {
|
|||
pub struct Background<W: Content<Tui>>(pub Color, W);
|
||||
|
||||
impl<W: Content<Tui>> Content<Tui> for Background<W> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
Some(&self.1)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) {
|
||||
|
|
@ -59,14 +59,14 @@ impl<W: Content<Tui>> Content<Tui> for Background<W> {
|
|||
pub struct Styled<T: Content<Tui>>(pub Option<Style>, pub T);
|
||||
|
||||
impl Content<Tui> for Styled<&str> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
Some(&self.1)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) {
|
||||
// FIXME
|
||||
let [x, y, ..] = to.area();
|
||||
//let [w, h] = self.min_size(to.area().wh())?.unwrap();
|
||||
Ok(to.blit(&self.1, x, y, None))
|
||||
to.blit(&self.1, x, y, None)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue