#pragma once

#include <stdio.h>
#include <string>
#include <map>
#include "xmlscript.h"
#include "xmlfontstring.h"
#include "xmltexture.h"
#include "xmlframe.h"
#include "xmlmodel.h"
#include "xmlbutton.h"
#include "xmlcheckbutton.h"
#include "xmlradiobutton.h"
#include "xmlslider.h"
#include "xmlstatusbar.h"
#include "xmleditbox.h"
#include "xmllistbox.h"
#include "xmlmessageframe.h"
#include "xmlscrollframe.h"
#include "xmlTooltip.h"

using namespace std;

class CXmlUi;
class CXmlFile;

class CXmlFile
{
public:
	CXmlFile(CXmlUi* pXmlUi);
	~CXmlFile();

	virtual	bool			LoadFile(const string& pathname, const string& filename);
public:
	CXmlUi*					m_pXmlUi;
	vector<CXmlNode*>		m_nodes;
	string					m_pathname;
	string					m_filename;
};

class CXmlUi
{
public:	
	CXmlUi();
	virtual ~CXmlUi();
	virtual	bool			OpenToc(const char* filename);
	virtual	void			AddName(const char* name, CXmlLayout* layout);
	virtual CXmlLayout*		FindByName(const char* name);

protected:	
	//virtual	bool			LoadFile(const string& pathname, const string& filename);
	virtual	bool			ReadLine(FILE *fptr, string& lineStr);
	virtual	bool			CheckTocFile(const string& filename);
	virtual	bool			CheckXmlFile(const string& filename);
	virtual	string			GetFileExt(const string& filename);
	virtual	string			GetPath(const string& filename);

public:
	map<string, CXmlLayout*>	m_nameIndex;
	vector<CXmlFile*>			m_files;
};

