1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
use tui::{text::Text, widgets::Paragraph, Frame};
use crate::tuine::{DrawContext, StateContext, TmpComponent};
/// A [`NetGraph`] is a widget displaying RAM/SWAP data in a graph-like form.
pub struct NetGraph {}
impl super::AppWidget for NetGraph {
fn build_widget(
ctx: &mut crate::tuine::BuildContext<'_>, painter: &crate::canvas::Painter,
config: &crate::app::AppConfig, data: &mut crate::data_conversion::ConvertedData<'_>,
) -> Self {
Self {}
}
}
impl<Message> TmpComponent<Message> for NetGraph {
fn draw<Backend>(
&mut self, _state_ctx: &mut StateContext<'_>, draw_ctx: &DrawContext<'_>,
frame: &mut Frame<'_, Backend>,
) where
Backend: tui::backend::Backend,
{
let rect = draw_ctx.global_rect();
frame.render_widget(
Paragraph::new(Text::raw("Net Graph")).block(tui::widgets::Block::default()),
rect,
);
}
}
|