Verified Commit 138c6b15 authored by Moritz Sokoll's avatar Moritz Sokoll 🦀
Browse files

added widgets

parent 4bee56ff
Pipeline #336 passed with stages
in 38 seconds
[package]
name = "btui"
version = "0.6.11"
version = "0.6.12"
edition = "2018"
authors = ["Moritz Sokoll <moritz@sokoll.com>"]
license = "MIT"
......
......@@ -27,6 +27,9 @@ pub mod linux;
/// module containing a progressbar
pub mod pbar;
/// widgets implementation
pub mod widget;
pub use linux::Terminal;
pub use ft::{effects, print};
......
......@@ -3,6 +3,7 @@ use std::io::{stderr, stdin, stdout};
use std::io::{Error, ErrorKind, Write};
use std::io::{Stderr, Stdin, Stdout};
use std::ops::Neg;
use crate::widget;
/// module containig different console actions for linux
#[deprecated(
since = "0.6.7",
......@@ -229,6 +230,12 @@ impl Terminal {
// }}}
// Widget support: {{{
pub fn draw_widget<T: widget::Widget>(&self, widget: T) -> Result<(), Error> {
self.println(widget.render())
}
// }}}
}
impl Default for Terminal {
......
/// trait for a widget
pub trait Widget {
fn render(&self) -> String;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment