#ifndef JUST_LOOK_H
#define JUST_LOOK_H

#include <exec/types.h>
#include <devices/inputevent.h>

#define SPEEDLEVELS 9

/* these are the possible return values. note that combinations are also
   possible (a routine may return the ORed value of more than one error) */
#define NO_ERROR   0x00000000 /* every thing ok */
#define NO_PORT    0x80000001 /* could not open messageport */
#define NO_SIG     0x80000002 /* could not allocate signals */ 
#define NO_MEM     0x80000004 /* could not allocate enough memory */
#define NO_EXTIO   0x80000008 /* could not create IO structure */
#define NO_DEVICE  0x80000010 /* could not open InputEvent device */
#define NO_MOVE    0x80000020 /* mouse pointer does not move */
#define NO_WIN     0x80000040 /* window not found */
#define NO_SCR     0X80000080 /* screen not found */ 
#define NO_GAD     0x80000100 /* gadget not found */
#define NO_BUTTON  0x80000200 /* no such mouse button */
#define NO_SM      0x80000400 /* SM is null! */
#define NO_ACT     0x80000800 /* unappropriate or unknown  action specified */
#define BAD_ITEM   0x80001000 /* illegal menu number (less than zero) */
#define NO_MENU    0x80002000 /* no such menu  */
#define NO_ITEM    0x80004000 /* no such menu item */
#define NO_SUB     0x80008000 /* no such sub menu */
#define NO_RATIO   0x80010000 /* could not get screen ratios */
#define NO_OBJ     0x80020000 /* icon or it's gadget not found */
#define NO_KEY     0x80040000 /* RawInfo poiter is null */
#define NO_STRUCT  0x80080000 /* required dtructure is null */
#define PORT_FOUND 0x80100000 /* input event already disabled! */
#define TRUNCATED  0x80200000 /* given coordinates are out of bound */


/* these are the qualifiers */
#define LSHIFT   IEQUALIFIER_LSHIFT
#define RSHIFT   IEQUALIFIER_RSHIFT
#define CAPSLOCK IEQUALIFIER_CAPSLOCK1
#define CTRL     IEQUALIFIER_CONTROL
#define LALT     IEQUALIFIER_LALT
#define RALT     IEQUALIFIER_RALT
#define LCMD     IEQUALIFIER_LCOMMAND
#define RCMD     IEQUALIFIER_RCOMMAND
#define NUMPAD   IEQUALIFIER_NUMERICPAD
#define REP      IEQUALIFIER_REPEAT
#define INT      IEQUALIFIER_INTERRUPT
#define MULTB    IEQUALIFIER_MULTIBROADCAST
#define MIDB     IEQUALIFIER_MIDBUTTON
#define RB       IEQUALIFIER_RBUTTON
#define LB       IEQUALIFIER_LEFTBUTTON
#define RELMOUSE IEQUALIFIER_RELATIVEMOUSE

/* mouse or keyboard input can be disabled. used for IEEnable() and 
   IEDisable() routines*/
#define MOUSE 0x1
#define KBD   0x2

/* more than one window or screen with the specified name (no window pointer
   can begin at address 1 in Amiga!  */
#define SCR_REPEATED (struct Screen *)1
#define WIN_REPEATED (struct Window *)1 

/* parameters passes to WinAct() */
#define CLOSEWIN 100
#define DEPTHWIN 101

/* used for routines that move the mouse pointer */
#define ABSOLUTE FALSE 
#define RELATIVE TRUE

/* used for the Click() routine */
#define DOWN    0
#define UP      1
#define DOWN_UP 2

#define LBUTTON   0
#define RBUTTON   1
#define MIDBUTTON 2

/* used in WaitIE() routine */
#define LBMASK  (1 << LBUTTON)
#define MBMASK  (1 << MIDBUTTON)
#define RBMASK  (1 << RBUTTON)

/* global definitions. used in many places */ 
typedef LONG ErrorCode;
typedef LONG BOOLEAN;

/* is used to contain various information about the mouse position */
struct ScrMap 
{
 WORD CurrX,CurrY,DestX,DestY,XRatio,YRatio;
 struct Screen *Scr;
};

/* used by RawType() routine */
struct RawInfo
{
 UWORD RawKey,Qualifier;
};


/* prototypes */

ErrorCode ChooseMenu(struct ScrMap *, struct Window *, SHORT, SHORT, SHORT);

ErrorCode Click(struct ScrMap *, WORD, UWORD, WORD);

ErrorCode ClickGad(struct ScrMap *, struct Window *, char *, USHORT, SHORT);

struct Gadget *FindGad(struct Window *, char *, USHORT);

struct Screen *FindScreen(char *);

struct Window *FindWindow(char *, struct Screen *);

/*ErrorCode GetRatio(struct ScrMap *SM,struct Screen *Scr);you don't need it*/

ErrorCode GoOverGad(struct ScrMap *, struct Window *, char *, USHORT ,SHORT);

ErrorCode GoOverIcon(struct ScrMap *, struct Window *, UBYTE *);

ErrorCode IEDisable(LONG);

ErrorCode IEEnable(LONG);

ErrorCode IEWait(LONG);

ErrorCode InitSM(struct ScrMap *, struct Screen *);

ErrorCode MoveMouse(struct ScrMap *, BOOLEAN, SHORT);

ErrorCode RawType(struct RawInfo *, ULONG, ULONG);

VOID Rel2Abs(struct ScrMap *, SHORT *, SHORT *);

VOID SetDest(struct ScrMap *, SHORT, SHORT);

ErrorCode WinAct(struct ScrMap *, struct Window *, LONG);

ErrorCode WinDrag(struct ScrMap *, struct Window *, BOOLEAN, SHORT, SHORT);

ErrorCode WinResize(struct ScrMap *, struct Window *, BOOLEAN, SHORT, SHORT);

#endif
