#ifndef _STATE_DEF_INCLUDED

#define _STATE_DEF_INCLUDED

#include "object.def"

typedef struct state STATE;

typedef enum {
    DORMANT
,   OVERBOX
,   MOVING
,   EDITING
,   SIZING
,   CREATING
,   ALIGNING
,   PASTE_PENDING
,   PASTEING
,   SELECTING
,   MOVE_PENDING
,   ACTION_ABORTED
,   KBD_MOVING
} STATE_ID;

#define H_SIZE( a )     (a>>2)
#define V_SIZE( a )     (a & 3)
#define SQUAREWIDTH 8
#define ACCELS 5

extern void       SetState( STATE_ID );
extern STATE_ID   GetState( void );
extern void       SetDefState( void );
extern void       NewState( void );
extern void       SetStateWnd( HWND );
extern void       FreeState( void );
extern void       SetBaseState( STATE_ID );

extern void       SetSize( RESIZE_ID );
extern BOOL       Sizing( char );
extern void       ResetSize( void );

extern void       SetPrevMouse( POINT );
extern POINT      GetPrevMouse( void );

extern HANDLE     GetAppWnd( void );
extern HANDLE     GetInst( void );
extern void       SetInst( HANDLE );
extern HANDLE     GetClientWnd( void );
extern void       SetClientWnd( HANDLE );

extern void       CreateMainObject( void );
extern void       DestroyMainObject( void );

extern OBJPTR     GetCurrObj( void );
extern void       CreateCurrObject( void );
extern void       DestroyCurrObject( void );

extern void       RestorePrevObject( void );
extern void       SaveObject( void );

extern void       SetObjects( void * );
extern void *     GetObjects( void );

extern void       SetErr( char * );
extern char *     GetErr( void );
extern unsigned char GetSizing( void );

extern void       SetOffset( POINT );
extern void       SetScrollRect( RECT );
extern RECT       GetScrollRect( void );
extern void       SetScrollConfig( SCR_CONFIG );
extern SCR_CONFIG GetScrollConfig( void );

extern OBJPTR     GetSelectEatom( void );
extern void       SetSelectEatom( OBJPTR );

extern BOOL       GetShift( void );
extern BOOL       GetControl( void );
extern void       SetKeyState( WORD );

extern void       ReportPending( void );

extern void       LoadAccel( int );
extern HWND       InheritState( HWND );
extern void       MouseAction( RECT * );
extern void       SetResizeGrid( unsigned, unsigned );
extern unsigned   GetResizeVInc( void );
extern unsigned   GetResizeHInc( void );
extern BOOL   GetShowEatoms( void );
extern void   SetShowEatoms( BOOL show );
#endif
