#ifndef _BINDINGS_
#define _BINDINGS_

#include <X11/Xlib.h>
#include "misc.hh"

struct CharMask
{
	char c;
	unsigned long mask;
};

struct Cmd;

struct Binding
{
	Binding *next;
	Cmd *cmd; // func to exec

	unsigned long mods;
	unsigned long context;

	virtual int handle_KeyPress () {};
	virtual int handle_ButtonPress () {};
	virtual int grab (Window) {};
	int parse_mods ();
};

struct KeyBind: Binding
{
	KeyCode keycode;

	KeyBind ();
	int parse_context ();
	int grab (Window);
	int handle_KeyPress ();
};

struct MouseBind: Binding
{ 
	int button;

	MouseBind ();
	int parse_context ();
	int grab (Window);
	int handle_ButtonPress ();
};

struct BindList
{
	Binding *first;

	BindList ();
	~BindList ();
	int add (Binding *);
	int grab (Window);
	int ungrab (Window);
	int handle_event ();
};

//********************************************************************

struct ActiveArea
{
	ActiveArea *next;

	int type;
	int x, y, wd, ht;
	Window w;
	Cmd *cmd;

	ActiveArea (int);
	int init ();
};

#define AA_HOVER 1
#define AA_CLICK 2

struct ActiveList
{
	MyColor back;
	ActiveArea *first;
	int n;

	ActiveList ();
	int add (ActiveArea *);
	int find (ActiveArea *&, Window w);
	int find (Window w);
	int handle_event ();
	int init ();
};


//********************************************************************

extern BindList bind_list;
extern ActiveList active_list;
extern int double_click_ms;

#endif
