/*
*Copyright(c)2018, Jeffrey Lee
*Allrightsreserved.
*
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met: 
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIMP_H
#define LIMP_H

typedef struct {
	int b[64];
	_kernel_swi_regs r;
	int task;
	char fonts[256];
	void *mem;
	int memsize;
} limp_obj;

extern limp_obj limp;

extern void Limp_Initialise(char *name);
extern void Limp_OpenTemplate(char *name);
extern int Limp_LoadTemplate(char *name,void *fonts);
extern void Limp_CloseTemplate();
extern int Limp_CreateWindow(void *block);
extern int Limp_CreateIcon(int r0,void *block);
extern void Limp_DeleteWindow(int h);
extern void Limp_DeleteIcon(int w,int h);
extern void Limp_OpenWindow(int h,int vmin_x,int vmin_y,int vmax_x,int vmax_y,int sx,int sy,int pos);
extern void Limp_CloseWindow(int h);
extern int Limp_Poll(int mask,void *w);
extern int Limp_RedrawWindow(int h);
extern int Limp_UpdateWindow(int h,int minx,int miny,int maxx,int maxy);
extern int Limp_GetRectangle();
extern void Limp_GetWindowState(int h);
extern void Limp_GetWindowInfo(int f,void *b,int h);
extern void Limp_SetIconState(int w,int h,int e,int c);
extern int *Limp_GetIconState(int w,int h);
extern void Limp_GetPointerInfo();
extern void Limp_DragBox(void *b);
extern void Limp_ForceRedraw(int w,int minx,int miny,int maxx,int maxy);
extern void Limp_SetCaretPosition(int w,int i,int x,int y,int h,int p);
extern void Limp_GetCaretPosition();
extern void Limp_CreateMenu(void *b,int x,int y);
extern void Limp_DecodeMenu(void *m,void *l,void *b);
extern void Limp_WhichIcon(int w,void *b,int m,int f);
extern void Limp_SetExtent(int h,int minx,int miny,int maxx,int maxy);
extern void Limp_SetPointerShape(int n,void *d,int w,int h,int x,int y);
extern void Limp_ProcessKey(int c);
extern void Limp_CloseDown();
extern void Limp_StartTask(char *cmd);
extern void Limp_ReportError(int num,char *msg,int flags,char *title);
extern void Limp_GetWindowOutline(int w);
extern void Limp_PollIdle(int m,int t,void *b);
extern void Limp_PlotIcon(void *b);
extern void Limp_SetMode(int m);
extern void Limp_SetPalette(void *b);
extern void Limp_ReadPalette(void *b);
extern void Limp_SetColour(int c);
extern void Limp_SendMessage(int code,void *b,int h,int i);
extern void Limp_CreateSubMenu(void *b,int x,int y);
extern void Limp_SpriteOp(int code,char *name);
extern int Limp_ROMBaseOfSprites();
extern int Limp_RMABaseOfSprites();
extern void Limp_BlockCopy(int h,int minx,int miny,int maxx,int maxy,int dx,int dy);
extern void Limp_SlotSize(int cur,int next);
extern void Limp_ReadPixTrans(int r0,int r1,void *r2,void *r6,void *r7);
extern void Limp_ClaimFreeMemory(int o,int a);
extern void Limp_CommandWindow(int o);
extern void Limp_TextColour(int c);
extern void Limp_TransferBlock(int sh,void *sb,int dh,void *db,int l);
extern int Limp_ReadSysInfo(int i);
extern void Limp_SetFontColours(int b,int f);
extern void Limp_GetMenuState(int f,void *b,int w,int i);
extern void Limp_RegisterFilter(int c,int a,int r);
extern void Limp_AddMessages(void *b);
extern void Limp_RemoveMessages(void *b);
extern void Limp_SetColourMapping(void *p,void *a,void *b,void *c);

extern void Limp_SetIconText(int w,int h,char *t);
extern char *Limp_GetIconText(int w,int h);
extern void Limp_SelectESGIcon(int w,int esg,int h,int c);
extern int Limp_GetSelectedESGIcon(int w,int esg);
extern char *Limp_GetIconValidation(int w,int h);
extern void Limp_SetIconValidation(int w,int h,char *v);
extern char *Limp_GetIconSprite(int w,int h);

#endif
