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