todo-cli
Loading...
Searching...
No Matches
vi_view.h
Go to the documentation of this file.
1#pragma once
2
3#include <ncurses.h>
4
5#include "types.h"
6#include "view.h"
7
8namespace todo {
9class ViView : public View {
10private:
11 WINDOW *list_pad_{nullptr};
12 WINDOW *notif_{
13 nullptr
14 };
15
16 struct {
17 u16 x{};
18 u16 y{};
19 } cursor_;
20
21 i16 initial_cursor_x_;
23
24 i16 border_y_{};
25 i16 border_x_{};
26 i16 scroll_offset_{};
27
28 enum class Mode : u8 {
29 NORMAL = 0,
30 REMOVE = 1,
31 CHANGE = 2,
32 SIBLING_INSERT = 3,
33 CHILD_INSERT = 4,
34 DESC_CHANGE = 5,
35 } mode_{Mode::NORMAL};
36
37 enum class InsertChain : u8 {
38 DESC = 0,
39 PATH = 1,
40 PRIORITY = 2,
41 DATE = 3,
42 } curr_event_{
43 InsertChain::DESC
44 };
45
46public:
48 ViView();
49
51 ~ViView();
52
55 virtual UserInput get_input(const std::string &msg) override;
56
60 virtual void display_list(
61 const std::vector<Task> &todo_list, u16 level = 0
62 ) override;
63
66 virtual void display_msg(const std::string &msg) override;
67
68private:
70 void refresh_list_view();
71
73 UserInput handle_normal();
74
76 UserInput handle_remove();
77
79 UserInput handle_change();
80
82 UserInput handle_insert();
83
85 UserInput handle_desc_change();
86
88 void handle_child_insert();
89
91 void handle_sibling_insert();
92};
93} // namespace todo
ViView()
Default constructor.
Definition vi_view.cpp:9
~ViView()
Destructor.
Definition vi_view.cpp:33
virtual void display_msg(const std::string &msg) override
Display message to screen.
Definition vi_view.cpp:395
virtual UserInput get_input(const std::string &msg) override
Gets input from the user.
Definition vi_view.cpp:45
u16 x
Definition vi_view.h:17
u16 y
Definition vi_view.h:18
virtual void display_list(const std::vector< Task > &todo_list, u16 level=0) override
Display task list to screen.
Definition vi_view.cpp:303
View()=default
Default Constructor.
Definition actions.cpp:3
uint16_t u16
Definition types.h:14
uint8_t u8
Definition types.h:13
int16_t i16
Definition types.h:9