summaryrefslogtreecommitdiff
path: root/src/ncurses_ui.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-09-10 23:39:19 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-09-10 23:39:19 +0100
commit80726a789b811e4e122ffae5174b2e044b64caea (patch)
treee94fef11a0a5361d5d9d3e38374af99e59dc82b7 /src/ncurses_ui.hh
parenta685a928f76921aa7898df33c68f1ef91b782d8a (diff)
Refactor NCursesUI implementation, use pads instead of windows
Diffstat (limited to 'src/ncurses_ui.hh')
-rw-r--r--src/ncurses_ui.hh21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/ncurses_ui.hh b/src/ncurses_ui.hh
index f68e6a8d..ce221a29 100644
--- a/src/ncurses_ui.hh
+++ b/src/ncurses_ui.hh
@@ -57,13 +57,26 @@ private:
void draw_line(const DisplayLine& line, CharCount col_index,
const Face& default_face) const;
- void mark_dirty(NCursesWin* region);
-
NCursesWin* m_window = nullptr;
CharCoord m_dimensions;
- NCursesWin* m_menu_win = nullptr;
+ struct Window
+ {
+ void create(const CharCoord& pos, const CharCoord& size);
+ void destroy();
+ void refresh();
+
+ explicit operator bool() const { return win; }
+
+ NCursesWin* win = nullptr;
+ CharCoord pos;
+ CharCoord size;
+ };
+
+ void mark_dirty(const Window& win);
+
+ Window m_menu;
Vector<String> m_items;
Face m_menu_fg;
Face m_menu_bg;
@@ -72,7 +85,7 @@ private:
LineCount m_menu_top_line = 0;
void draw_menu();
- NCursesWin* m_info_win = nullptr;
+ Window m_info;
FDWatcher m_stdin_watcher;
InputCallback m_input_callback;