#ifndef __FLASH_EVENT_H__
#define __FLASH_EVENT_H__

typedef struct FlashEventResize
{
    int x,y,w,h;
} FlashEventResize;

typedef struct FlashEventKey
{
	int p1, p2, p3;
} FlashEventKey;

typedef struct FlashEventMouse
{
	int p1, p2, p3;
} FlashEventMouse;

/* for callback */

typedef struct FlashEventCallItem
{
    /* 0 int, 1 bool, 2 float, 3 string */
    int type;
    int len;
    char data[0];
} FlashEventCallItem;

typedef struct FlashEventCall
{
    int count;
    FlashEventCallItem item[1];
} FlashEventCall;

typedef struct FlashEventSetUrl
{
    int len;
    char data[0];
} FlashEventSetUrl;

#define EVENTTYPE_VOID      0x00000000
#define EVENTTYPE_RESIZE    0x00000001
#define EVENTTYPE_KEY		0x00000002
#define EVENTTYPE_MOUSE		0x00000003
#define EVENTTYPE_FOCUS     0x00000004
#define EVENTTYPE_BLUR      0x00000005
#define EVENTTYPE_CALL      0x00000006
#define EVENTTYPE_RET       0x00000007
#define EVENTTYPE_SETURL	0x00000008
#define EVENTTYPE_EXIT      0x00000009

typedef struct FlashEvent
{
    int type;
    int len;
    union
    {
        FlashEventResize resize;
        FlashEventKey key;
        FlashEventMouse mouse;
        FlashEventCall call;
        FlashEventCallItem ret;
        FlashEventSetUrl seturl;
    };
} FlashEvent;

#define MAX_FLASH_EVENT_SIZE (1024)
#define FLASH_EVENT_HEADER_SIZE (8)
#define FLASH_CALL_ITEM_HEADER_SIZE (8)

#endif
