#ifndef _COMMON_WINTIMER_HPP_
#define _COMMON_WINTIMER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_WINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif

class WinTimer : public Window
{
public:
	WinTimer(HINSTANCE hProcessInstance);
  WinTimer(const Window &someWindow);
	~WinTimer();
	WORD insertHandler(PureCallback *lpCallback);
	void removeHandler(PureCallback *lpCallback);
	WORD startTimer(UINT delayTime);
	WORD stopTimer(void);
	DWORD getSystemTime(void)const;
private:
	enum {TimerID=0,InvalidID=32767};
	void initWinTimer(void);
	void registerClass(void);
	void createWindow(void);

	CallbackData::ReturnType timerHandler(CallbackData &someCallbackData);
	Callback<WinTimer> mTimerHandler;
  Block<CallbackPointer> mCallbackVector;
	WORD mIsOkay;
	UINT mTimerID;
  HINSTANCE mhInstance;
	static char smszClassName[];
  static char smszMenuName[];
};

inline
DWORD WinTimer::getSystemTime(void)const
{
  return ::GetTickCount();
}
#endif


