NCursesUI: redraw becomes a member
This commit is contained in:
parent
93cad94330
commit
bdc47ddef8
|
@ -118,18 +118,19 @@ NCursesUI::~NCursesUI()
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void redraw(WINDOW* menu_win, WINDOW* info_win)
|
void NCursesUI::redraw()
|
||||||
{
|
{
|
||||||
|
redrawwin(stdscr);
|
||||||
wnoutrefresh(stdscr);
|
wnoutrefresh(stdscr);
|
||||||
if (menu_win)
|
if (m_menu_win)
|
||||||
{
|
{
|
||||||
redrawwin(menu_win);
|
redrawwin(m_menu_win);
|
||||||
wnoutrefresh(menu_win);
|
wnoutrefresh(m_menu_win);
|
||||||
}
|
}
|
||||||
if (info_win)
|
if (m_info_win)
|
||||||
{
|
{
|
||||||
redrawwin(info_win);
|
redrawwin(m_info_win);
|
||||||
wnoutrefresh(info_win);
|
wnoutrefresh(m_info_win);
|
||||||
}
|
}
|
||||||
doupdate();
|
doupdate();
|
||||||
}
|
}
|
||||||
|
@ -221,7 +222,7 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
|
||||||
addutf8str(stdscr, Utf8Iterator(mode_line.begin()),
|
addutf8str(stdscr, Utf8Iterator(mode_line.begin()),
|
||||||
Utf8Iterator(mode_line.end()));
|
Utf8Iterator(mode_line.end()));
|
||||||
}
|
}
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct getch_iterator
|
struct getch_iterator
|
||||||
|
@ -315,7 +316,7 @@ void NCursesUI::print_status(const String& status, CharCount cursor_pos)
|
||||||
m_status_line = status;
|
m_status_line = status;
|
||||||
m_status_cursor = cursor_pos;
|
m_status_cursor = cursor_pos;
|
||||||
draw_status();
|
draw_status();
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NCursesUI::menu_show(const memoryview<String>& choices,
|
void NCursesUI::menu_show(const memoryview<String>& choices,
|
||||||
|
@ -357,7 +358,7 @@ void NCursesUI::menu_show(const memoryview<String>& choices,
|
||||||
set_menu_fore(m_menu, COLOR_PAIR(m_menu_fg));
|
set_menu_fore(m_menu, COLOR_PAIR(m_menu_fg));
|
||||||
set_menu_back(m_menu, COLOR_PAIR(m_menu_bg));
|
set_menu_back(m_menu, COLOR_PAIR(m_menu_bg));
|
||||||
post_menu(m_menu);
|
post_menu(m_menu);
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NCursesUI::menu_select(int selected)
|
void NCursesUI::menu_select(int selected)
|
||||||
|
@ -370,7 +371,7 @@ void NCursesUI::menu_select(int selected)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
set_menu_fore(m_menu, COLOR_PAIR(m_menu_bg));
|
set_menu_fore(m_menu, COLOR_PAIR(m_menu_bg));
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NCursesUI::menu_hide()
|
void NCursesUI::menu_hide()
|
||||||
|
@ -387,7 +388,7 @@ void NCursesUI::menu_hide()
|
||||||
m_menu_win = nullptr;
|
m_menu_win = nullptr;
|
||||||
m_items.clear();
|
m_items.clear();
|
||||||
m_choices.clear();
|
m_choices.clear();
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DisplayCoord compute_needed_size(const String& str)
|
static DisplayCoord compute_needed_size(const String& str)
|
||||||
|
@ -457,7 +458,7 @@ void NCursesUI::info_show(const String& content, const DisplayCoord& anchor, Men
|
||||||
wmove(m_info_win, 0, 0);
|
wmove(m_info_win, 0, 0);
|
||||||
addutf8str(m_info_win, Utf8Iterator(content.begin()),
|
addutf8str(m_info_win, Utf8Iterator(content.begin()),
|
||||||
Utf8Iterator(content.end()));
|
Utf8Iterator(content.end()));
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NCursesUI::info_hide()
|
void NCursesUI::info_hide()
|
||||||
|
@ -466,7 +467,7 @@ void NCursesUI::info_hide()
|
||||||
return;
|
return;
|
||||||
delwin(m_info_win);
|
delwin(m_info_win);
|
||||||
m_info_win = nullptr;
|
m_info_win = nullptr;
|
||||||
redraw(m_menu_win, m_info_win);
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayCoord NCursesUI::dimensions()
|
DisplayCoord NCursesUI::dimensions()
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
DisplayCoord dimensions() override;
|
DisplayCoord dimensions() override;
|
||||||
private:
|
private:
|
||||||
friend void on_term_resize(int);
|
friend void on_term_resize(int);
|
||||||
|
void redraw();
|
||||||
|
|
||||||
DisplayCoord m_dimensions;
|
DisplayCoord m_dimensions;
|
||||||
void update_dimensions();
|
void update_dimensions();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user