Skip to content

Instantly share code, notes, and snippets.

@Daniel-Wang
Last active April 21, 2018 08:27
Show Gist options
  • Save Daniel-Wang/30d4e1a865f81ee35c7bceefe60da481 to your computer and use it in GitHub Desktop.
Save Daniel-Wang/30d4e1a865f81ee35c7bceefe60da481 to your computer and use it in GitHub Desktop.
View header file for Vm
// Includes
namespace vm {
class View {
public:
View(int height, int width, int startX, int startY);
~View();
void printBufferContent();
void setHighlighter(std::unique_ptr<Highlighter> highlighter);
void resetCursor();
virtual void printString(const std::string& text) const;
int height() const;
void setBackgroundColor(int pair);
void enableHighlightingAt(int xStart, int xFinish, int y);
void disableHighlighting();
private:
void setCursorAt(int x, int y);
void clearView() const;
int _height;
std::string _content;
std::pair<std::pair<int, int>, int> _highlight;
WINDOW* _window;
std::shared_ptr<Buffer> _buffer;
std::unique_ptr<Highlighter> _highlighter;
std::unique_ptr<ViewCursor> _cursor;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment