#ifndef _COMMON_DRAWITEM_HPP_
#define _COMMON_DRAWITEM_HPP_
#ifndef _COMMON_STDLIB_HPP_
#include <common/stdlib.hpp>
#endif
#ifndef _COMMON_COMMCTRL_HPP_
#include <common/commctrl.hpp>
#endif
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_RECTANGLE_HPP_
#include <common/rect.hpp>
#endif

class DrawItem : private DRAWITEMSTRUCT
{
public:
	enum ItemAction{Select=ODA_SELECT,DrawEntire=ODA_DRAWENTIRE,Focus=ODA_FOCUS};
	enum ControlType{Button=ODT_BUTTON,ComboBox=ODT_COMBOBOX,ListBox=ODT_LISTBOX,ListView=ODT_LISTVIEW,Menu=ODT_MENU,Static=ODT_STATIC,Tab=ODT_TAB};
	DrawItem(void);
	DrawItem(const DrawItem &someDrawItem);
	DrawItem(const DRAWITEMSTRUCT &someDRAWITEMSTRUCT);
	virtual ~DrawItem();
	DrawItem &operator=(const DrawItem &someDrawItem);
  DrawItem &operator=(const DRAWITEMSTRUCT &someDRAWITEMSTRUCT);
	WORD operator==(const DrawItem &someDrawItem);
	ControlType controlType(void)const;
	void controlType(ControlType controlType);
	UINT controlID(void)const;
	void controlID(UINT controlID);
	UINT itemID(void)const;
	void itemID(UINT itemID);
	ItemAction itemAction(void)const;
	void itemAction(ItemAction itemAction);
	UINT itemState(void)const;
	void itemState(UINT itemState);
	HWND hwndItem(void)const;
	void hwndItem(HWND hwndItem);
	HDC deviceContext(void)const;
	void deviceContext(HDC hDeviceContext);
	Rect rectItem(void)const;
	void rectItem(const Rect &rectItem);
	DWORD itemData(void)const;
  void itemData(DWORD itemData);
private:
  void setZero(void);
};

inline
DrawItem::DrawItem(void)
{
  setZero();
}

inline
DrawItem::DrawItem(const DrawItem &someDrawItem)
{
  *this=someDrawItem;
}


inline
DrawItem::DrawItem(const DRAWITEMSTRUCT &someDRAWITEMSTRUCT)
{
  *this=someDRAWITEMSTRUCT;
}

inline
DrawItem::~DrawItem()
{
}

inline
DrawItem &DrawItem::operator=(const DrawItem &someDrawItem)
{
	controlType(someDrawItem.controlType());
	controlID(someDrawItem.controlID());
	itemID(someDrawItem.itemID());
	itemAction(someDrawItem.itemAction());
	itemState(someDrawItem.itemState());
	hwndItem(someDrawItem.hwndItem());
	deviceContext(someDrawItem.deviceContext());
	rectItem(someDrawItem.rectItem());
	itemData(someDrawItem.itemData());
  return *this;
}

inline
DrawItem &DrawItem::operator=(const DRAWITEMSTRUCT &someDRAWITEMSTRUCT)
{
	::memcpy(&((DRAWITEMSTRUCT&)*this),&someDRAWITEMSTRUCT,sizeof(DRAWITEMSTRUCT));
  return *this;
}

inline
WORD DrawItem::operator==(const DrawItem &someDrawItem)
{
	return (controlType()==someDrawItem.controlType()&&
					controlID()==someDrawItem.controlID()&&
					itemID()==someDrawItem.itemID()&&
					itemAction()==someDrawItem.itemAction()&&
					itemState()==someDrawItem.itemState()&&
					hwndItem()==someDrawItem.hwndItem()&&
					deviceContext()==someDrawItem.deviceContext()&&
					rectItem()==someDrawItem.rectItem()&&
	        itemData()==someDrawItem.itemData());
}


inline
DrawItem::ControlType DrawItem::controlType(void)const
{
	return (ControlType)DRAWITEMSTRUCT::CtlType;
}

inline
void DrawItem::controlType(ControlType controlType)
{
	DRAWITEMSTRUCT::CtlType=(ControlType)controlType;
}

inline
UINT DrawItem::controlID(void)const
{
	return DRAWITEMSTRUCT::CtlID;
}

inline
void DrawItem::controlID(UINT controlID)
{
	DRAWITEMSTRUCT::CtlID=controlID;
}

inline
UINT DrawItem::itemID(void)const
{
  return DRAWITEMSTRUCT::itemID;
}

inline
void DrawItem::itemID(UINT itemID)
{
  DRAWITEMSTRUCT::itemID;
}

inline
DrawItem::ItemAction DrawItem::itemAction(void)const
{
  return (ItemAction)DRAWITEMSTRUCT::itemAction;
}

inline
void DrawItem::itemAction(ItemAction itemAction)
{
  DRAWITEMSTRUCT::itemAction=(UINT)itemAction;
}

inline
UINT DrawItem::itemState(void)const
{
  return DRAWITEMSTRUCT::itemState;
}

inline
void DrawItem::itemState(UINT itemState)
{
  DRAWITEMSTRUCT::itemState=itemState;
}

inline
HWND DrawItem::hwndItem(void)const
{
	return DRAWITEMSTRUCT::hwndItem;
}

inline
void DrawItem::hwndItem(HWND hwndItem)
{
	DRAWITEMSTRUCT::hwndItem=hwndItem;
}

inline
HDC DrawItem::deviceContext(void)const
{
	return DRAWITEMSTRUCT::hDC;
}

inline
void DrawItem::deviceContext(HDC hDeviceContext)
{
	DRAWITEMSTRUCT::hDC=hDeviceContext;
}

inline
Rect DrawItem::rectItem(void)const
{
	return DRAWITEMSTRUCT::rcItem;
}

inline
void DrawItem::rectItem(const Rect &rectItem)
{
	DRAWITEMSTRUCT::rcItem.left=rectItem.left();
	DRAWITEMSTRUCT::rcItem.top=rectItem.top();
	DRAWITEMSTRUCT::rcItem.right=rectItem.right();
	DRAWITEMSTRUCT::rcItem.bottom=rectItem.bottom();
}

inline
DWORD DrawItem::itemData(void)const
{
  return DRAWITEMSTRUCT::itemData;
}

inline
void DrawItem::itemData(DWORD itemData)
{
  DRAWITEMSTRUCT::itemData=itemData;
}

inline
void DrawItem::setZero(void)
{
  ::memset(&(DRAWITEMSTRUCT&)*this,0,sizeof(DRAWITEMSTRUCT));
}
#endif
