aboutsummaryrefslogtreecommitdiff
path: root/src/habit/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/habit/traits.rs')
-rw-r--r--src/habit/traits.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/habit/traits.rs b/src/habit/traits.rs
index 74fd00b..289fd95 100644
--- a/src/habit/traits.rs
+++ b/src/habit/traits.rs
@@ -1,10 +1,11 @@
1use chrono::NaiveDate; 1use chrono::NaiveDate;
2use cursive::direction::Direction; 2use cursive::direction::{Absolute, Direction};
3use cursive::event::{Event, EventResult}; 3use cursive::event::{Event, EventResult};
4use cursive::{Printer, Vec2}; 4use cursive::{Printer, Vec2};
5 5
6use typetag; 6use typetag;
7 7
8use crate::app::Cursor;
8use crate::habit::{Bit, Count, TrackEvent, ViewMode}; 9use crate::habit::{Bit, Count, TrackEvent, ViewMode};
9use crate::views::ShadowView; 10use crate::views::ShadowView;
10 11
@@ -24,6 +25,9 @@ pub trait Habit {
24 fn set_view_month_offset(&mut self, offset: u32); 25 fn set_view_month_offset(&mut self, offset: u32);
25 fn view_month_offset(&self) -> u32; 26 fn view_month_offset(&self) -> u32;
26 27
28 fn move_cursor(&mut self, d: Absolute);
29 fn cursor(&self) -> Cursor;
30
27 fn set_view_mode(&mut self, mode: ViewMode); 31 fn set_view_mode(&mut self, mode: ViewMode);
28 fn view_mode(&self) -> ViewMode; 32 fn view_mode(&self) -> ViewMode;
29 33
@@ -44,6 +48,9 @@ pub trait HabitWrapper: erased_serde::Serialize {
44 fn set_view_month_offset(&mut self, offset: u32); 48 fn set_view_month_offset(&mut self, offset: u32);
45 fn view_month_offset(&self) -> u32; 49 fn view_month_offset(&self) -> u32;
46 50
51 fn move_cursor(&mut self, d: Absolute);
52 fn cursor(&self) -> Cursor;
53
47 fn set_view_mode(&mut self, mode: ViewMode); 54 fn set_view_mode(&mut self, mode: ViewMode);
48 fn view_mode(&self) -> ViewMode; 55 fn view_mode(&self) -> ViewMode;
49 56
@@ -87,6 +94,12 @@ macro_rules! auto_habit_impl {
87 fn view_month_offset(&self) -> u32 { 94 fn view_month_offset(&self) -> u32 {
88 Habit::view_month_offset(self) 95 Habit::view_month_offset(self)
89 } 96 }
97 fn move_cursor(&mut self, d: Absolute) {
98 Habit::move_cursor(self, d)
99 }
100 fn cursor(&self) -> Cursor {
101 Habit::cursor(self)
102 }
90 fn set_view_mode(&mut self, mode: ViewMode) { 103 fn set_view_mode(&mut self, mode: ViewMode) {
91 Habit::set_view_mode(self, mode) 104 Habit::set_view_mode(self, mode)
92 } 105 }