mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-09-28 13:35:37 +00:00
add widget trait
This commit is contained in:
@@ -13,3 +13,11 @@ pub use mem_graph::*;
|
||||
pub use net_graph::*;
|
||||
pub use process_table::*;
|
||||
pub use temperature_table::*;
|
||||
|
||||
use tui::{layout::Rect, Frame};
|
||||
|
||||
/// A [`Widget`] converts raw data into something that a user can see and interact with.
|
||||
pub trait Widget<Data> {
|
||||
/// How to actually draw the widget to the terminal.
|
||||
fn draw(&self, f: &mut Frame<'_>, draw_location: Rect, widget_id: u64);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#[derive(Default)]
|
||||
pub struct BatteryWidgetState {
|
||||
pub currently_selected_battery_index: usize,
|
||||
pub tab_click_locs: Option<Vec<((u16, u16), (u16, u16))>>,
|
||||
}
|
||||
Reference in New Issue
Block a user