#ifndef __NT_EVENT_H__
#define __NT_EVENT_H__

namespace NTCurses {

typedef enum {
	NT_EVENT_NULL = 0,
	NT_EVENT_KEYPRESS,
	NT_EVENT_MOUSE,
	NT_EVENT_MODAL_EXIT,
	NT_EVENT_NEXT_NODE_FOCUS,
	NT_EVENT_PREV_NODE_FOCUS,
	NT_EVENT_PREV_ROW_FOCUS,
	NT_EVENT_NEXT_ROW_FOCUS,
	NT_EVENT_PREV_PAGE_ROW_FOCUS,
	NT_EVENT_NEXT_PAGE_ROW_FOCUS,
	NT_EVENT_PARENT_FOCUS,
	NT_EVENT_SET_CURSOR_POS_X,
	NT_EVENT_SET_CURSOR_POS_Y,
	NT_EVENT_SET_CURSOR_POS,
	NT_EVENT_CUSTOM,
} NTEventType;

typedef union {
	struct {
		int x;
		int y;
		int z;
		unsigned int buttonstate;
	} mouse_state;
	struct {
		int pos_x;
		int pos_y;
	} pos;
	struct {
		int eventcode;
		void *customptr;	
	} custom;
	int keycode;
	int modal_exit;
	int pos_x;
	int pos_y;
} NTEventData;

class NTEvent {
public:
	NTEvent();
	~NTEvent();

	NTEvent( NTEventType etype );	
	NTEventType event_type;
	NTEventData event_data;

protected:
	// protected methods
	void InitEvent( void );

	// protected attributes
	void *event_params;
};

// key event
class NTKeyEvent : public NTEvent {
public:
	NTKeyEvent( int kcode );
};

class NTMouseEvent : public NTEvent {
public:
	NTMouseEvent( int mx , int my , int mz , unsigned bstate );
};

class NTModalExitEvent : public NTEvent {
public:
	NTModalExitEvent( int exitcode = 0 );
};

class NTNextNodeControlEvent : public NTEvent {
public:
	NTNextNodeControlEvent( void );
};

class NTPrevNodeControlEvent : public NTEvent {
public:
	NTPrevNodeControlEvent( void );
};

class NTNextRowControlEvent : public NTEvent {
public:
	NTNextRowControlEvent( void );
};

class NTPrevRowControlEvent : public NTEvent {
public:
	NTPrevRowControlEvent( void );
};

class NTNextPageRowControlEvent : public NTEvent {
public:
	NTNextPageRowControlEvent( void );
};

class NTPrevPageRowControlEvent : public NTEvent {
public:
	NTPrevPageRowControlEvent( void );
};

class NTSetCursorPosXEvent : public NTEvent {
public:
	NTSetCursorPosXEvent( int pos );
};

class NTSetCursorPosYEvent : public NTEvent {
public:
	NTSetCursorPosYEvent( int pos );
};

class NTSetCursorPosEvent : public NTEvent {
public:
	NTSetCursorPosEvent( int px , int py );
};

class NTCustomEvent : public NTEvent {
public:
	NTCustomEvent( int code , void *ptr = 0 );
};

}


#endif
