#pragma once
#include "gosGml.hpp"
#include "History.h"

//===========================================================================//
// File:	 RRAPI.cpp														 //
// Project:  gosGml						                                     //
// Contents: it's the ReallyRaw API											 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 7/7/00   DP     Created													 //
//---------------------------------------------------------------------------//
// Copyright (C) 2000 Microsoft Corp.						                 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

DWORD gosGml_RRCreateDisplay(char* fontPath, char* imagePath, int tabwidth=15); //create Gml system window, blank
void gosGml_RRDestroyDisplay(DWORD Victim); //destroy a Gml system window
int gosGml_RRDisplayGML(char* TextData, rect& DisplayTextArea, DWORD DisplaySystem); //display this Gml; does not clear pane if that is relevant
void gosGml_RRClearGML(DWORD DisplaySystem); //clear the Gml system, if relevant
char* gosGml_RRClick(int X, int Y, DWORD DisplaySystem);

DWORD gosGml_RRCreateHistory(); //create a history system
void gosGml_RRDestroyHistory(DWORD Victim); //destroy a history system
char* gosGml_RRHistoryForward(DWORD HistorySystem); //move forwards in history list, return next page
char* gosGml_RRHistoryBack(DWORD HistorySystem); //move backwards in history list, return previous page
void gosGml_RRHistoryAdd(char* Entry, DWORD HistorySystem); //add item to history list, clear all forward items
void gosGml_RRHistoryClear(DWORD HistorySystem); //clear history list
bool gosGml_RRHistoryForwardEmpty(DWORD HistorySystem); //are there any forward items?
bool gosGml_RRHistoryBackEmpty(DWORD HistorySystem); //are there any back items?



DWORD gosGml_RRCreateDisplay(char* fontPath, char* imagePath, int tabwidth, rect* DisplayTextArea)
{
return (DWORD)new GmlDisplaySystem(fontPath,imagePath, DisplayTextArea,tabwidth);
}

void gosGml_RRDestroyDisplay(DWORD Victim)
{
delete (GmlDisplaySystem*)Victim;
}

int gosGml_RRDisplayGML(char* TextData, DWORD DisplaySystem)
{
return ((GmlDisplaySystem*)DisplaySystem)->TextDrawGml(TextData);
}

void gosGml_RRClearGML(DWORD DisplaySystem)
{
((GmlDisplaySystem*)DisplaySystem)->Clear();
}

char* gosGml_RRClick(int X, int Y, DWORD DisplaySystem)
{
return ((GmlDisplaySystem*)DisplaySystem)->TestForHit(X,Y);
}


DWORD gosGml_RRCreateHistory()
{
return (DWORD)new History();
}

void gosGml_RRDestroyHistory(DWORD Victim)
{
delete (History*)Victim;
}

char* gosGml_RRHistoryForward(DWORD HistorySystem)
{
return ((History*)HistorySystem)->Forward();
}

char* gosGml_RRHistoryBack(DWORD HistorySystem)
{
return ((History*)HistorySystem)->Back();
}

void gosGml_RRHistoryAdd(char* Entry, DWORD HistorySystem)
{
((History*)HistorySystem)->Add(Entry);
}

void gosGml_RRHistoryClear(DWORD HistorySystem)
{
((History*)HistorySystem)->Clear();
}

bool gosGml_RRHistoryForwardEmpty(DWORD HistorySystem)
{
return ((History*)HistorySystem)->ForwardEmpty();
}

bool gosGml_RRHistoryBackEmpty(DWORD HistorySystem)
{
return ((History*)HistorySystem)->BackEmpty();
}

