#pragma once
#include "hash.h"
#include "gosGml API.h"
#include "Scrollbar.h"

//table of contents
class TocItem
{
	public:
		TocItem();
		~TocItem();
		char* Target;
		char* Name;
		unsigned char Level;
		TocItem* FirstChild;
		TocItem* NextSibling;
		bool Open;
	private:
		//TocItem(); //call me not
		TocItem(TocItem&);//don't call this
		TocItem& operator= (TocItem const &); //don't call the assignment operator
};

class Toc
{
	public:
		Toc(char* Input, char* fontPath, char* imagePath, char* defaultPagePath, rect* DisplayTextArea, int tabwidth);
		~Toc();
		char* Click(int x, int y);
		int Draw();
		void SetScrollOffset(int x);
	private:
		Toc(); //call me not
		Toc(Toc&);//don't call this
		Toc& operator= (Toc const &); //don't call the assignment operator

		TocItem* Head;
		rect* Dim;
		char* Text;
		GML* DS;
		Scrollbar* SB;

		char* MakeGML();
		void SMakeGML(char*& Data, TocItem* Item);	//sub make GML
		void Interpret(char* Data);
		void SInterpret(char*& Data, TocItem* Parent, int Level);	//sub interpret.
		void itoss(int I, unsigned char* Dest);
		int sstoi(unsigned char* S);
};