mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-31 01:24:31 +02:00
add widget trait
This commit is contained in:
parent
9efe60c66f
commit
80b91b4eb8
@ -13,3 +13,11 @@ pub use mem_graph::*;
|
|||||||
pub use net_graph::*;
|
pub use net_graph::*;
|
||||||
pub use process_table::*;
|
pub use process_table::*;
|
||||||
pub use temperature_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);
|
||||||
|
}
|
||||||
|
5
src/widgets/battery_info.rs
Normal file
5
src/widgets/battery_info.rs
Normal file
@ -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))>>,
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user