Files
cc3k/src/cursor.h

61 lines
1.6 KiB
C++

#ifndef __CURSOR_H__
#define __CURSOR_H__
#include <string>
#include <ncurses.h>
#include "position.h"
/* Attributes
A_NORMAL Normal display (no highlight)
A_STANDOUT Best highlighting mode of the terminal.
A_UNDERLINE Underlining
A_REVERSE Reverse video
A_BLINK Blinking
A_DIM Half bright
A_BOLD Extra bright or bold
A_PROTECT Protected mode
A_INVIS Invisible or blank mode
A_ALTCHARSET Alternate character set
A_CHARTEXT Bit-mask to extract a character
COLOR_PAIR(n) Color-pair number n
Color pair numbers
COLOR_BLACK 0
COLOR_RED 1
COLOR_GREEN 2
COLOR_YELLOW 3
COLOR_BLUE 4
COLOR_MAGENTA 5
COLOR_CYAN 6
COLOR_WHITE 7
*/
// IMPORTANT: use unique_ptr for cursor because:
// 1. Every instance of cursor will initialize a new ncurses screen
// Hence you should only have one instance of cursor at a time
// Otherwise IDK what'll happen
// 2. unique_ptr insures that only one copy of a pre-declared cursor can exist
class cursor final {
private:
public:
cursor();
~cursor();
int getcmd() const;
void show() const;
void clear() const ;
void print_char(const position &pos, const char ch, const int attrs) const;
void print_str(const position &head, const std::string str,
const int attrs) const;
};
// IMPORTANT: this will fail when terminal size changes
// checks if terminal size fits the minimum requirements
bool check_terminal_size();
#endif