2012-02-16 18:25:16 +04:00
|
|
|
#ifndef ncurses_hh_INCLUDED
|
|
|
|
#define ncurses_hh_INCLUDED
|
|
|
|
|
2012-08-30 23:53:22 +04:00
|
|
|
#include <ncurses.h>
|
|
|
|
#include <menu.h>
|
|
|
|
|
2012-09-24 21:24:27 +04:00
|
|
|
#include "user_interface.hh"
|
2012-09-30 17:18:37 +04:00
|
|
|
#include "display_buffer.hh"
|
2012-02-16 18:25:16 +04:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2012-09-24 21:24:27 +04:00
|
|
|
class NCursesUI : public UserInterface
|
2012-02-16 18:25:16 +04:00
|
|
|
{
|
2012-06-06 03:15:19 +04:00
|
|
|
public:
|
2012-09-24 21:24:27 +04:00
|
|
|
NCursesUI();
|
|
|
|
~NCursesUI();
|
2012-02-16 18:25:16 +04:00
|
|
|
|
2012-09-24 21:24:27 +04:00
|
|
|
NCursesUI(const NCursesUI&) = delete;
|
|
|
|
NCursesUI& operator=(const NCursesUI&) = delete;
|
2012-02-16 18:25:16 +04:00
|
|
|
|
2012-10-20 22:15:20 +04:00
|
|
|
void draw(const DisplayBuffer& display_buffer,
|
|
|
|
const String& status_line) override;
|
2012-09-03 16:22:02 +04:00
|
|
|
void print_status(const String& status, CharCount cursor_pos) override;
|
2012-06-06 03:15:19 +04:00
|
|
|
|
2012-09-03 16:22:02 +04:00
|
|
|
Key get_key() override;
|
2012-08-30 23:14:28 +04:00
|
|
|
|
2012-09-30 17:18:37 +04:00
|
|
|
void menu_show(const memoryview<String>& choices,
|
|
|
|
const DisplayCoord& anchor, MenuStyle style) override;
|
2012-09-05 21:02:06 +04:00
|
|
|
void menu_select(int selected) override;
|
|
|
|
void menu_hide() override;
|
2012-10-20 22:15:20 +04:00
|
|
|
|
|
|
|
DisplayCoord dimensions() override;
|
2012-08-30 23:53:22 +04:00
|
|
|
private:
|
2012-10-27 16:18:52 +04:00
|
|
|
friend void on_term_resize(int);
|
|
|
|
|
|
|
|
DisplayCoord m_dimensions;
|
|
|
|
void update_dimensions();
|
|
|
|
|
2012-09-30 17:18:37 +04:00
|
|
|
MENU* m_menu = nullptr;
|
|
|
|
WINDOW* m_menu_win = nullptr;
|
2012-08-30 23:53:22 +04:00
|
|
|
std::vector<ITEM*> m_items;
|
|
|
|
std::vector<String> m_choices;
|
2012-09-05 02:49:59 +04:00
|
|
|
|
2012-09-30 17:18:37 +04:00
|
|
|
DisplayCoord m_menu_pos;
|
|
|
|
DisplayCoord m_menu_size;
|
|
|
|
|
2012-10-27 16:18:52 +04:00
|
|
|
|
2012-09-05 02:49:59 +04:00
|
|
|
int m_menu_fg;
|
|
|
|
int m_menu_bg;
|
2012-06-06 03:15:19 +04:00
|
|
|
};
|
2012-02-16 18:25:16 +04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ncurses_hh_INCLUDED
|
|
|
|
|