diff --git a/src/widgets.rs b/src/widgets.rs index 21cf0479..a477e1d2 100644 --- a/src/widgets.rs +++ b/src/widgets.rs @@ -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 { + /// How to actually draw the widget to the terminal. + fn draw(&self, f: &mut Frame<'_>, draw_location: Rect, widget_id: u64); +} diff --git a/src/widgets/battery_info.rs b/src/widgets/battery_info.rs new file mode 100644 index 00000000..68bbca79 --- /dev/null +++ b/src/widgets/battery_info.rs @@ -0,0 +1,5 @@ +#[derive(Default)] +pub struct BatteryWidgetState { + pub currently_selected_battery_index: usize, + pub tab_click_locs: Option>, +}