Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CSE3150_Project/FormatterInterface.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
81 lines (66 sloc)
1.9 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef FORMATTER_INTERFACE_H | |
#define FORMATTER_INTERFACE_H | |
#include <string> | |
#include <memory> | |
class FormatterImplementation | |
{ | |
public: | |
virtual ~FormatterImplementation() {}; | |
// Settings | |
virtual void SetMaxWidth(int maxWidth) = 0; | |
virtual int GetMaxWidth() = 0; | |
virtual void SetMaxHeight(int maxHeight) = 0; | |
virtual int GetMaxHeight() = 0; | |
// Render Methods | |
virtual void Build() = 0; | |
virtual int GetRenderableLineCount() = 0; | |
virtual std::shared_ptr<std::string> GetLine(int x) = 0; | |
virtual void GetCursorPosition(int &row, int &col) = 0; | |
virtual void SetCursorPosition(int row, int col) = 0; | |
// Actions | |
virtual void HandleMoveLeft() = 0; | |
virtual void HandleMoveRight() = 0; | |
virtual void HandleMoveUp() = 0; | |
virtual void HandleMoveDown() = 0; | |
// Special Actions | |
virtual void HandlePageUp() = 0; | |
virtual void HandlePageDown() = 0; | |
virtual void HandleHome() = 0; | |
virtual void HandleEnd() = 0; | |
// Adjustment Methods | |
virtual void GridToCursor(int &row, int &col) = 0; | |
virtual void CursorToGrid(int &row, int &col) = 0; | |
}; | |
class FormatterInterface | |
{ | |
public: | |
FormatterInterface(); | |
~FormatterInterface(); | |
// Settings | |
void SetImplementor(FormatterImplementation *imp); | |
void SetMaxWidth(int maxWidth); | |
int GetMaxWidth(); | |
void SetMaxHeight(int maxHeight); | |
int GetMaxHeight(); | |
// Render Methods | |
void Build(); | |
int GetRenderableLineCount(); | |
std::shared_ptr<std::string> GetLine(int x); | |
void GetCursorPosition(int &row, int &col); | |
void GetPosition(int &row, int &col); | |
void SetPosition(int row, int col); | |
// Actions | |
void HandleMoveLeft(); | |
void HandleMoveRight(); | |
void HandleMoveUp(); | |
void HandleMoveDown(); | |
// Special Keys | |
void HandlePageUp(); | |
void HandlePageDown(); | |
void HandleHome(); | |
void HandleEnd(); | |
private: | |
void CheckImplementor(); | |
std::shared_ptr<FormatterImplementation> implementor; | |
}; | |
#endif /* VIEW_CONTROLLER_INTERFACE_H */ |