// XmlGuiCategoryInfo.h
//

#if !defined (_XMLGUICATEGORYINFO_H_)
#define _XMLGUICATEGORYINFO_H_

#include <vector>
#include "XmlBaseElement.h"

using namespace std;

class CXmlGuiCategoryField;
class CXmlClassInfo;

typedef vector<CXmlGuiCategoryField*> FieldList;

class CXmlGuiCategoryInfo: public CXmlBaseElement
{
public:
	CXmlGuiCategoryInfo();
	virtual ~CXmlGuiCategoryInfo();

	// implementation of XmlBaseElement
	//
	virtual bool BuildFromXml(IXMLDOMNode* node);
	virtual bool AppendToDOMDocument(IXMLDOMDocument2* xmlDoc, IXMLDOMElement* parentElement);

	static cmString GetXmlNodeName(){return _T("GuiCategoryInfo");}

	void SetCaption(const cmString& caption);
	cmString GetCaption();
	
	void SetDescription(const cmString& caption);
	cmString GetDescription();

	CXmlGuiCategoryField* InsertField(int index);
	CXmlGuiCategoryField* GetField(int index);
	CXmlGuiCategoryField* GetFieldByCaption(const cmString& caption);
	CXmlGuiCategoryField* GetFieldByMemberName(const cmString& memberName);

	void RemoveField(const cmString& name);
	void RemoveField(int index);
	void RemoveField(CXmlGuiCategoryField* field);

	void MoveUpField(int index);
	void MoveDownField(int index);

	int GetFieldCount();

	void SetContracted(bool contracted);
	bool GetContracted();

	void SetSorted(bool sorted);
	bool GetSorted() const;

	void SetClassInfo(CXmlClassInfo* classInfo);

protected:
	void Clear();
	void MoveField(int oldIndex, int newIndex);
	
	cmString caption_;
	cmString description_;
	FieldList fields_;
	bool contracted_;
	bool sorted_;

	CXmlClassInfo* classInfo_;
};


#endif // !defined(_XMLGUICATEGORYINFO_H_)