summaryrefslogtreecommitdiffstats
path: root/ui/src/components/mail/listing.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/components/mail/listing.rs')
-rw-r--r--ui/src/components/mail/listing.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/ui/src/components/mail/listing.rs b/ui/src/components/mail/listing.rs
index bdd0b1de..d8e40c19 100644
--- a/ui/src/components/mail/listing.rs
+++ b/ui/src/components/mail/listing.rs
@@ -30,6 +30,12 @@ pub use self::thread::*;
mod plain;
pub use self::plain::*;
+#[derive(Debug, Default, Clone)]
+pub(in crate::listing) struct DataColumns {
+ columns: [CellBuffer; 12],
+ widths: [usize; 12], // widths of columns calculated in first draw and after size changes
+}
+
#[derive(Debug)]
struct AccountMenuEntry {
name: String,
@@ -40,6 +46,8 @@ struct AccountMenuEntry {
trait ListingTrait {
fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>);
fn set_coordinates(&mut self, _: (usize, usize, Option<EnvelopeHash>));
+ fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context);
+ fn highlight_line(&mut self, grid: &mut CellBuffer, area: Area, idx: usize, context: &Context);
}
#[derive(Debug)]
@@ -65,6 +73,20 @@ impl ListingTrait for ListingComponent {
Threaded(ref mut l) => l.set_coordinates(c),
}
}
+ fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
+ match self {
+ Compact(ref mut l) => l.draw_list(grid, area, context),
+ Plain(ref mut l) => l.draw_list(grid, area, context),
+ Threaded(ref mut l) => l.draw_list(grid, area, context),
+ }
+ }
+ fn highlight_line(&mut self, grid: &mut CellBuffer, area: Area, idx: usize, context: &Context) {
+ match self {
+ Compact(ref mut l) => l.highlight_line(grid, area, idx, context),
+ Plain(ref mut l) => l.highlight_line(grid, area, idx, context),
+ Threaded(ref mut l) => l.highlight_line(grid, area, idx, context),
+ }
+ }
}
#[derive(Debug)]
@@ -123,11 +145,11 @@ impl Component for Listing {
grid[(mid, i)].set_bg(Color::Default);
}
}
- self.dirty = false;
context
.dirty_areas
.push_back(((mid, get_y(upper_left)), (mid, get_y(bottom_right))));
}
+ self.dirty = false;
if right_component_width == total_cols {
match self.component {
Compact(ref mut l) => l.draw(grid, area, context),