#pragma once

#include "Vectors.h"

enum grabMessageType {
	grabMESSAGE_DESTROY				= 0x0,
	grabMESSAGE_PAINT				= 0x1,
	grabMESSAGE_KEY_DOWN			= 0x2,
	grabMESSAGE_KEY_UP				= 0x3,
	grabMESSAGE_MOUSE_BUTTON_UP		= 0x4,
	grabMESSAGE_MOUSE_BUTTON_DOWN	= 0x5,
	grabMESSAGE_NOT_DEFINED			= 0x6,
	grabMESSAGE_TIMER				= 0x7,
	grabMESSAGE_RESIZE				= 0x8
};

union grabWindowMessage;
struct grabMsgKeyDown;
struct grabMsgKeyUp;
struct grabMsgCommon;
struct grabMsgNotDefined;
struct grabMsgTimer;
struct grabMsgResize;
struct grabMsgMBUp;

struct grabMsgCommon {
	unsigned int Milliseconds;
	grabMessageType Type;
	Vec2<unsigned int> MousePos;
};

struct grabMsgKeyDown : grabMsgCommon {
	unsigned char Key;
	bool PrevState;
	short RepeatCount;
};

struct grabMsgKeyUp : grabMsgCommon {
	unsigned char Key;
};

struct grabMsgNotDefined : grabMsgCommon {
	MSG Data;
};

struct grabMsgTimer : grabMsgCommon {
	unsigned int ID;
};

struct grabMsgResize : grabMsgCommon {
	Vec2<unsigned int> Size;
};

struct grabMsgMBUp : grabMsgCommon {
	unsigned int Button;
};

union grabWindowMessage {
	grabMsgCommon CommonMessage;
	grabMsgKeyDown KeyDownMessage;
	grabMsgKeyUp KeyUpMessage;
	grabMsgNotDefined NotDefinedMessage;
	grabMsgTimer TimerMessage;
	grabMsgResize ResizeMessage;
	grabMsgMBUp MouseButtonUpMessage;
};