// CXmlBaseFormItem.h
//

#if !defined(_CXMLBASEFORMITEM_H_)
#define _CXMLBASEFORMITEM_H_

#include "stdafx.h"
#include "XmlSerializable.h"
#include "enums.h"
#include <string>

using namespace std;

class CXmlBaseFormItem: public CXmlSerializable
{
public:
	CXmlBaseFormItem();
	virtual ~CXmlBaseFormItem();

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

public:
	virtual CRect GetItemRect();
	virtual void SetItemRect(const CRect& itemRect);

	virtual cmString GetRelatedClassMemberId();
	virtual void SetRelatedClassMemberId(const cmString& id);

	virtual cmString GetRelatedClassMemberName();
	virtual void SetRelatedClassMemberName(const cmString& classMemberName);

	virtual cmString GetName();
	virtual void SetName(const cmString& name);

	virtual enFormItemType GetItemType() = 0;

	DWORD GetId() {return id_;}
	void SetId(DWORD id) {id_ = id;}

	void SetTop(int top);
	void SetLeft(int left);
	void SetWidth(int widsth);
	void SetHeight(int height);

	virtual cmString GetXmlNodeName(){return _T("BaseFormItem");}

protected:

	virtual void Clear();
	virtual void SetDefaults();

	// properties group: Position
	//
	CRect itemRect_;
	
	// properties group: General
	//
	cmString name_;
	
	cmString relatedClassMemberName_;
	cmString relatedClassMemberId_;

private:
	bool ReadRectNode(IXMLDOMNode* rectNode);

	DWORD id_;
};

#endif //!defined(_CXMLBASEFORMITEM_H_)