Simple actions dispatching on terminal emulator
This commit is contained in:
+35
-9
@@ -5,23 +5,49 @@
|
||||
#include "parser.hpp"
|
||||
|
||||
namespace Terminal {
|
||||
class Terminal {
|
||||
class Cell {
|
||||
public:
|
||||
Cell *overlapping_cell;
|
||||
std::vector<wchar_t> contents;
|
||||
std::vector<Cell *> overlapped_cells;
|
||||
|
||||
Cell();
|
||||
|
||||
Cell( const Cell & );
|
||||
Cell & operator=( const Cell & );
|
||||
};
|
||||
|
||||
class Row {
|
||||
public:
|
||||
std::vector<Cell> cells;
|
||||
|
||||
Row( size_t s_width );
|
||||
};
|
||||
|
||||
class Emulator {
|
||||
friend void Parser::Print::act_on_terminal( Emulator * );
|
||||
|
||||
private:
|
||||
Parser::UTF8Parser parser;
|
||||
|
||||
wchar_t *framebuffer;
|
||||
size_t width, height;
|
||||
|
||||
size_t cursor_col, cursor_row;
|
||||
size_t combining_char_col, combining_char_row;
|
||||
|
||||
std::vector<Row> rows;
|
||||
|
||||
void print( Parser::Print *act );
|
||||
|
||||
public:
|
||||
Terminal();
|
||||
~Terminal();
|
||||
Emulator( size_t s_width, size_t s_height );
|
||||
~Emulator();
|
||||
|
||||
|
||||
|
||||
Terminal( const Terminal & );
|
||||
Terminal &operator=( const Terminal & );
|
||||
void input( char c );
|
||||
|
||||
void resize( size_t s_width, size_t s_height );
|
||||
|
||||
size_t get_width( void ) { return width; }
|
||||
size_t get_height( void ) { return height; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user