diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-04-01 20:31:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-01 20:31:43 -0400 |
commit | 0b1d84fdf590bf8cacc5d0f94b67f63daa9b768a (patch) | |
tree | d2ff261148f9ef21f2e860af43f795df911c5c79 /src/canvas/widgets/mem_basic.rs | |
parent | c1a19f960fc1b348dd4465fe9a4d698bed229c77 (diff) |
Add modularity to widget placement and inclusion (#95)
Diffstat (limited to 'src/canvas/widgets/mem_basic.rs')
-rw-r--r-- | src/canvas/widgets/mem_basic.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/canvas/widgets/mem_basic.rs b/src/canvas/widgets/mem_basic.rs index 0dcfaced..75ffcacf 100644 --- a/src/canvas/widgets/mem_basic.rs +++ b/src/canvas/widgets/mem_basic.rs @@ -1,7 +1,7 @@ use std::cmp::max; use crate::{ - app::{App, WidgetPosition}, + app::App, canvas::{drawing_utils::*, Painter}, constants::*, }; @@ -15,13 +15,13 @@ use tui::{ pub trait MemBasicWidget { fn draw_basic_memory<B: Backend>( - &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, + &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, widget_id: u64, ); } impl MemBasicWidget for Painter { fn draw_basic_memory<B: Backend>( - &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, + &self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, widget_id: u64, ) { let mem_data: &[(f64, f64)] = &app_state.canvas_data.mem_data; let swap_data: &[(f64, f64)] = &app_state.canvas_data.swap_data; @@ -31,7 +31,7 @@ impl MemBasicWidget for Painter { .horizontal_margin(1) .split(draw_loc); - if let WidgetPosition::BasicMem = app_state.current_widget_selected { + if app_state.current_widget.widget_id == widget_id { Block::default() .borders(*SIDE_BORDERS) .border_style(self.colours.highlighted_border_style) |