#if !defined(_command_control_)
#define _command_control_


typedef enum {
	PROCESSSTATE_ACTIVE = 0,		/* Active  */
	PROCESSSTATE_SUSPEND			/* Suspend */
}PROCESSSTATE;

typedef enum {
	PROCESSTYPE_W_DRAW 		= 0,		/* Draw Process  */
	PROCESSTYPE_WO_DRAW					/* No Draw Process */
}PROCESSTYPE;

typedef enum {
	DCXMESSAGE_DESTROY_WINDOW = 0	,
	DCXMESSAGE_STOP_WINDOW			,
	DCXMESSAGE_CURRENT_WINDOW		,
	DCXMESSAGE_MOVE_WINDOW			,
	DCXMESSAGE_CHANGE_WINDOW_SIZE	,
	DCXMESSAGE_DISPLAY_HELP			,
	DCXMESSAGE_PADDING
}DCXMESSAGETYPE;

typedef enum {
	PROCESS_PRIORITY_CRITICAL = 0	,
	PROCESS_PRIORITY_HIGH			,
	PROCESS_PRIORITY_TOP_OF_DRAW	,
	PROCESS_PRIORITY_DRAW_HIGH		,
	PROCESS_PRIORITY_LAST_OF_DRAW	,
	PROCESS_PRIORITY_LOWEST
}PROCESSPRIORITY;

typedef struct {
	DCXMESSAGETYPE	eType;
	PKMVOID			pContext;
}DCXMESSAGE, *PDCXMESSAGE;

/* Callback Prototypes */
typedef VOID (* PMESSAGECALLBACKFUNC)(PKMVOID hProcess, PDCXMESSAGE pMessage );
typedef VOID (* PCOMMANDFUNC)(int pArgs, char *argv[] );

typedef struct {
	PKMVOID				pPrev;
	PKMVOID				pNext;
	PCOMMANDFUNC		pCommand;
	PKMCALLBACKFUNC		pProcess;
	PMESSAGECALLBACKFUNC pMessage;
	PKMVOID				pData;
	PROCESSSTATE		Attrib;
	PROCESSTYPE			ProcessType;
	KMBOOLEAN			IsLastDraw;
	KMRECT				Clipper;
	KMRECT				Client;
	char				CommandName[32];
}COMMANDSTRUCT, *PCOMMANDSTRUCT;

typedef struct {
	PCOMMANDSTRUCT 	RegistTop;
	KMDWORD			nRegistratedCommand;
}COMMANDCONTROL, *PCOMMANDCONTROL;

typedef PCOMMANDCONTROL PROCESSHANDLE;

/*
	Prototype
*/
void InitializeCommand( void);

PROCESSHANDLE RegisterCommand(	PCOMMANDFUNC pFunc, 
								PKMCALLBACKFUNC pProcess, 
								PKMVOID pData, 
								char* pszName, 
								PROCESSTYPE ProcessType);

int ExecuteCommand( char *pszCommandLine);

int ExecuteProcess( PKMSYSTEMCONFIGSTRUCT pSysConfig);

int ActivateProcess(PROCESSHANDLE hProcess);

int SuspendProcess(PROCESSHANDLE hProcess);

void SetWindowArea(PROCESSHANDLE hProcess, int OrgX, int OrgY, int XSize, int YSize);

int GetClientRect(PROCESSHANDLE hProcess , PKMRECT pRect);

int ChangeLastDraw2TopDraw(void);

int LoadTextureFmGD(char *filename);

void FreeAllTextureList(void);

void Invalidate(void);

void MoveCurrentWindow(int dx, int dy);

int SetMessageCallback(	PROCESSHANDLE hProcess, PMESSAGECALLBACKFUNC pFunc);

int killProcess(PROCESSHANDLE hProcess);

KMBOOLEAN ChangeProcessPriority(PROCESSHANDLE hProcess, PROCESSPRIORITY Priority);

/*
	Command Initialize
*/

void InitMemCommand(void);
void InitBorderCommand(void);
void InitClsCommand(void);
void InitHelpCommand(void);
void InitDispTexCommand(void);
void InitDrawBasic(void);

extern COMMANDCONTROL Command;

#endif
