#ifndef _COMMON_ICONFRAME_HPP_
#define _COMMON_ICONFRAME_HPP_
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _COMMON_PUREICON_HPP_
#include <common/pureicon.hpp>
#endif
#ifndef _COMMON_ICONBITMAP_HPP_
#include <common/iconbmp.hpp>
#endif

class IconFrame : public Block<IconBitmap>
{
public:
	IconFrame(void);
	IconFrame(const IconFrame &someIconFrame);
	virtual ~IconFrame();
	IconFrame &operator+=(const PureIcon &somePureIcon);
	IconFrame &operator=(const IconFrame &someIconFrame);
	WORD operator==(const IconFrame &someIconFrame)const;
	WORD drawIcon(PureDevice &somePureDevice,const Point &xyPoint);
	void remove(void);
private:
  void drawFrame(PureDevice &displayDevice,IconBitmap &someIconBitmap,const Point &xyPoint);

  Point mCurrentPoint;
	WORD mCurrentFrame;
	PureBitmap mBitmapBkGnd;
};

inline
IconFrame::IconFrame(void)
: mCurrentFrame(0)
{
}

inline
IconFrame::IconFrame(const IconFrame &someIconFrame)
{
	*this=someIconFrame;
}

inline
IconFrame::~IconFrame()
{
}

inline
IconFrame &IconFrame::operator+=(const PureIcon &somePureIcon)
{
	if(somePureIcon.isOkay())insert(&IconBitmap(somePureIcon));
	return *this;
}

inline
IconFrame &IconFrame::operator=(const IconFrame &someIconFrame)
{
	(Block<IconBitmap>&)*this=(Block<IconBitmap>&)someIconFrame;
	return *this;
}

inline
WORD IconFrame::operator==(const IconFrame &someIconFrame)const
{
	return (Block<IconBitmap>&)*this==(Block<IconBitmap>&)someIconFrame;
}

inline
void IconFrame::remove(void)
{
	Block<IconBitmap>::remove();
}

inline
WORD IconFrame::drawIcon(PureDevice &somePureDevice,const Point &xyPoint)
{
	if(!size())return FALSE;
	if(mCurrentFrame>=size())mCurrentFrame=0;
	drawFrame(somePureDevice,operator[](mCurrentFrame),xyPoint);
	mCurrentFrame++;
	return TRUE;
}
#endif
