#ifndef SCREEN_HH # define SCREEN_HH_ # include # include #define KEY_RETURN 10 #define KEY_EOF 4 class Screen { public: typedef std::deque t_lines; public: Screen(); void init(); void login(); void dialog(); void eventsloop(); void msg_print(const string &s); private: void create_windows(); void cmd_draw(); void msg_draw(); void msg_add(const string &s); void msg_load(const string &filename); void msg_save(const string &filename) const; const string &msg_get(size_t i) const; size_t msg_size() const; bool add_char(char c, char *string, ssize_t offset, size_t buf_len); bool del_char(char *string, ssize_t offset, size_t buf_len); private: // msg window WINDOW *msg_; t_lines msg_table_; char *msg_buffer_; // cmd window WINDOW *cmd_; char cmd_buffer_[MAX_LINE_SIZE]; char cmd_history_buffer_[MAX_LINE_SIZE]; size_t cmd_buf_off_; size_t cmd_win_off_; size_t cmd_history_off_; }; Screen &operator<< (Screen &, const string &s); #endif