#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "commons.h"

#define MAX_LINES 15

class cCcScroller{
	public:
		cCcScroller();
		~cCcScroller();
		
		bool SetWindow(int width = 32, int height = 3); //graphic coordinates
		int GetHeight()	{return text_height;};
		int GetWidth()	{return text_width;	};
		bool AddText(char *text);
		bool AddText(char *text, int length);
		bool AddNewLine(char *text);
		bool Clear(void);
		bool Backspace(void);
		bool TabOffset(int offset); // 0 < offset < 3
		bool DelEndLine(void);
		bool Scroll(int lines = 1);
		char **GetLines(void);
		int CountLines(void);
	protected:
		bool WrapText(char *text, int width);
		
	private:		
		int text_width, text_height; //graphic coordinates
		
		char *lines[MAX_LINES];
		int	crtLine;
};
