#pragma once
#ifdef LAB_ONLY
//#define GosGML_InternalTest
#endif
#pragma warning(disable:4710)
#pragma warning(disable:4711)

//===========================================================================//
// File:	 gosGml.cpp														 //
// Project:  GameOS					                                         //
// Contents: Precompiled header file - Generates the precompiled header		 //
//---------------------------------------------------------------------------//
// Date      Who    Modification                                             //
// 4/10/00   JR     Created													 //
//---------------------------------------------------------------------------//
// Copyright (C) 2000 Microsoft Corp.						                 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//
#define GmlFastCache
#include <GameOS\ToolOS.hpp>  //for the gos_DoesFileExist function only as of 5/7/0
#include <GameOS\GameOS.hpp>
#include <GOSScript\GOSScriptHeaders.hpp>
#include <stdlib.h>
#include <string.h>
#include <mbstring.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <Wininet.h>


typedef char* (*ParserCallback)(char* ID);

struct SearchRes
{
	char* Data;
	SearchRes* Next;
};

struct ImageData
{
	char* Name;
	char* Alt;
	DWORD Handle;
	int x;
	int y;
};

struct ExportImageData
{
	ImageData* Image;
	ExportImageData* Next;
};

struct GMLHyperlink
{
	char* Name;
	char* Target;
	char* Alt;
};

struct ExportHyperlink
{
	GMLHyperlink* HLink;
	ExportHyperlink* Next;
};

struct rect
{
    long Bottom;
    long Left;
    long Right;
    long Top;
};


int _stdcall SetTab(void * instance, int nargs, void * args[16]);
int _stdcall TextSideDraw(void * instance, int nargs, void * args[16]);

char* _stdcall RawTextGotClick(int x, int y);
int _stdcall TextGotClick(void * instance, int nargs, void * args[16]);

SearchRes* Search(const char* Target);
void Jump(const char* Target);


//History list

int BackGotClick();
int ForwardsGotClick();
void HistoryAdd(char* Str);

int _stdcall BackGotClickCB(void * instance, int nargs, void * args[16]);
int _stdcall ForwardsGotClickCB(void * instance, int nargs, void * args[16]);
void _stdcall HistoryAddCB(void * instance, int nargs, void * args[16]);

char* HistoryBack();
char* HistoryForwards();

bool BackIsEmpty();
bool ForwardsIsEmpty();

void HistoryClear();


//internal functions

void LoadDefaultPage(const char* lp);
int _gos_GetPage( const char* FileName, BYTE** MemoryImage, DWORD* Size );
char* _gos_LocatePage(const char* FileName);
void _gos_SetDefaultPath(const char* Path);
size_t mstrlen( const char *string );
char* mstrcpy( char *strDestination, const char *strSource );
int mstrcmp( const char *string1, const char *string2 );
int mstricmp( const char *string1, const char *string2 );
char *mbpinc( const char *current );
char *mbpdec( const char *current );
char *mbpncpy( char *strDest, const char *strSource, size_t count );
char* AppendStr(const char* First, const char* Second);
char* DupStr(const char* Orig);
char* MemToStr(const char* In, int Count);
inline DWORD LoadTex(char* Text);
int GetImageHeight(DWORD TexHandle);
int GetImageWidth(DWORD TexHandle);
bool WithinArea(int x, int y, rect* R);
void DrawImage(DWORD Tex, int x, int y);
void DrawDImage(DWORD Tex, rect* R);

#include "GmlDisplaySystem.h"
