/*
   Copyright 2008 Jeffrey Lee
   This file is part of WOUM.
   WOUM is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
   WOUM is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   You should have received a copy of the GNU General Public License
   along with WOUM.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LIMPX_H
#define __LIMPX_H

/* For LimpX Version 1.14 */

/*

				DEFINES FOR STUFF

*/

/* Wimp poll codes */
#define LIMPX_POLLCODE_NULL 0
#define LIMPX_POLLCODE_REDRAW_WINDOW 1
#define LIMPX_POLLCODE_OPEN_WINDOW 2
#define LIMPX_POLLCODE_CLOSE_WINDOW 3
#define LIMPX_POLLCODE_POINTER_LEAVE 4
#define LIMPX_POLLCODE_POINTER_ENTER 5
#define LIMPX_POLLCODE_MOUSE_CLICK 6
#define LIMPX_POLLCODE_USER_DRAG_BOX 7
#define LIMPX_POLLCODE_KEY_PRESSED 8
#define LIMPX_POLLCODE_MENU_SELECTION 9
#define LIMPX_POLLCODE_SCROLL_REQUEST 10
#define LIMPX_POLLCODE_LOSE_CARET 11
#define LIMPX_POLLCODE_GAIN_CARET 12
#define LIMPX_POLLCODE_POLLWORD_NONZERO 13
#define LIMPX_POLLCODE_USER_MESSAGE 17
#define LIMPX_POLLCODE_USER_MESSAGE_REC 18
#define LIMPX_POLLCODE_USER_MESSAGE_ACK 19

/* User messages */
#define LIMPX_USERMSG_QUIT 0
#define LIMPX_USERMSG_DATA_SAVE 1
#define LIMPX_USERMSG_DATA_SAVE_ACK 2
#define LIMPX_USERMSG_DATA_LOAD 3
#define LIMPX_USERMSG_DATA_LOAD_ACK 4
#define LIMPX_USERMSG_DATA_OPEN 5
#define LIMPX_USERMSG_RAM_FETCH 6
#define LIMPX_USERMSG_RAM_TRANSMIT 7
#define LIMPX_USERMSG_PREQUIT 8
#define LIMPX_USERMSG_PALETTE_CHANGE 9
#define LIMPX_USERMSG_SAVE_DESKTOP 0xA
#define LIMPX_USERMSG_CLAIM_ENTITY 0xF
#define LIMPX_USERMSG_DATA_REQUEST 0x10
#define LIMPX_USERMSG_DRAGGING 0x11
#define LIMPX_USERMSG_DRAG_CLAIM 0x12
#define LIMPX_USERMSG_FILER_OPENDIR 0x400
#define LIMPX_USERMSG_FILER_CLOSEDIR 0x401
#define LIMPX_USERMSG_HELP_REQUEST 0x502
#define LIMPX_USERMSG_HELP_REPLY 0x503
#define LIMPX_USERMSG_HELP_ENABLE 0x504
#define LIMPX_USERMSG_NOTIFY 0x40040
#define LIMPX_USERMSG_MENU_WARNING 0x400C0
#define LIMPX_USERMSG_MODE_CHANGE 0x400C1
#define LIMPX_USERMSG_TASK_INITIALISE 0x400C2
#define LIMPX_USERMSG_TASK_CLOSEDOWN 0x400C3
#define LIMPX_USERMSG_SLOTSIZE 0x400C4
#define LIMPX_USERMSG_SETSLOT 0x400C5
#define LIMPX_USERMSG_TASK_NAME_REQ 0x400C6
#define LIMPX_USERMSG_TASK_NAME_IS 0x400C7
#define LIMPX_USERMSG_TASK_STARTED 0x400C8
#define LIMPX_USERMSG_MENUS_DELETED 0x400C9
#define LIMPX_USERMSG_ICONIZE 0x400CA
#define LIMPX_USERMSG_WINDOW_CLOSED 0x400CB
#define LIMPX_USERMSG_WINDOW_INFO 0x400CC
#define LIMPX_USERMSG_SWAP 0x400CD
#define LIMPX_USERMSG_TOOLS_CHANGED 0x400CE
#define LIMPX_USERMSG_FONT_CHANGED 0x400CF
#define LIMPX_USERMSG_THROWBACK_START 0x42580
#define LIMPX_USERMSG_PROCESSING_FILE 0x42581
#define LIMPX_USERMSG_ERRORS_IN 0x42582
#define LIMPX_USERMSG_ERROR_DETAILS 0x42583
#define LIMPX_USERMSG_THROWBACK_END 0x42584
#define LIMPX_USERMSG_INFO_FOR_FILE 0x42585
#define LIMPX_USERMSG_INFO_DETAILS 0x42586
#define LIMPX_USERMSG_EDIT_REQ 0x45D80
#define LIMPX_USERMSG_EDIT_ACK 0x45D81
#define LIMPX_USERMSG_EDIT_RETURN 0x45D82
#define LIMPX_USERMSG_EDIT_ABORT 0x45D83
#define LIMPX_USERMSG_EDIT_DATA_SAVE 0x45D84
#define LIMPX_USERMSG_EDIT_CURSOR 0x45D85
#define LIMPX_USERMSG_URI_STARTED 0x4E380
#define LIMPX_USERMSG_URI_DYING 0x4E381
#define LIMPX_USERMSG_URI_REQUEST 0x4E382
#define LIMPX_USERMSG_URI_RESULT 0x4E383
#define LIMPX_USERMSG_PRINT_FILE 0x80140
#define LIMPX_USERMSG_WILL_PRINT 0x80141
#define LIMPX_USERMSG_PRINT_SAVE 0x80142
#define LIMPX_USERMSG_PRINT_INIT 0x80143
#define LIMPX_USERMSG_PRINT_ERROR 0x80144
#define LIMPX_USERMSG_PRINT_TYPE_ODD 0x80145
#define LIMPX_USERMSG_PRINT_TYPE_KNOWN 0x80146
#define LIMPX_USERMSG_SET_PRINTER 0x80147
#define LIMPX_USERMSG_PSPRINTER_QUERY 0x8014C
#define LIMPX_USERMSG_PSPRINTER_ACK 0x8014D
#define LIMPX_USERMSG_PSPRINTER_MODIFIED 0x8014E
#define LIMPX_USERMSG_PSPRINTER_DEFAULTS 0x8014F
#define LIMPX_USERMSG_PSPRINTER_DEFAULTED 0x80150
#define LIMPX_USERMSG_PSPRINTER_NOTPS 0x80151
#define LIMPX_USERMSG_RESET_PRINTER 0x80152
#define LIMPX_USERMSG_PS_IS_FONT_PRINT_RUNNING 0x80153
#define LIMPX_USERMSG_TASKWIN_INPUT 0x808C0
#define LIMPX_USERMSG_TASKWIN_OUTPUT 0x808C1
#define LIMPX_USERMSG_TASKWIN_EGO 0x808C2
#define LIMPX_USERMSG_TASKWIN_MORIO 0x808C3
#define LIMPX_USERMSG_TASKWIN_MORITE 0x808C4
#define LIMPX_USERMSG_TASKWIN_NEWTASK 0x808C5
#define LIMPX_USERMSG_TASKWIN_SUSPEND 0x808C6
#define LIMPX_USERMSG_TASKWIN_RESUME 0x808C7
#define LIMPX_USERMSG_OLE_FILECHANGED 0x80E1E
#define LIMPX_USERMSG_OLE_OPENSESSION 0x80E21
#define LIMPX_USERMSG_OLE_OPENSESSION_ACK 0x80E22
#define LIMPX_USERMSG_OLE_CLOSESESSION 0x80E23
#define LIMPX_USERMSG_DDE_TOOLINFO 0x81400
#define LIMPX_USERMSG_NEWSBASE_COMMAND 0x83580
#define LIMPX_USERMSG_NEWSBASE_REPLY 0x83581
#define LIMPX_USERMSG_NEWSBASE_UPDATE 0x83582
#define LIMPX_USERMSG_IRC_SENDDATA 0xDAB00
#define LIMPX_USERMSG_IRC_SENDRAWDATA 0xDAB01

/* Window flags */
#define LIMPX_WINFLAG_OLD_HASTITLE 1
#define LIMPX_WINFLAG_DRAGGABLE 2
#define LIMPX_WINFLAG_OLD_VERTBAR 4
#define LIMPX_WINFLAG_OLD_HORZBAR 8
#define LIMPX_WINFLAG_WIMP_REDRAW 16
#define LIMPX_WINFLAG_PANE 32
#define LIMPX_WINFLAG_OFFSCREEN 64
#define LIMPX_WINFLAG_OLD_NOCLOSE 128
#define LIMPX_WINFLAG_SCROLLREQ_WITH_AUTOREPEAT 256
#define LIMPX_WINFLAG_SCROLLREQ_WITHOUT_AUTOREPEAT 512
#define LIMPX_WINFLAG_COLOURS_GCOL 1024
#define LIMPX_WINFLAG_ATBACK 2048
#define LIMPX_WINFLAG_TRAP_KEYS 4096
#define LIMPX_WINFLAG_FORCE_ONSCREEN 8192
#define LIMPX_WINFLAG_IGNORE_RIGHTEXTENT 16384
#define LIMPX_WINFLAG_IGNORE_BOTTOMEXTENT 32768
#define LIMPX_WINFLAG_ISOPEN 65536
#define LIMPX_WINFLAG_IS_FULLY_VIS 131072
#define LIMPX_WINFLAG_IS_FULLSIZE 262144
#define LIMPX_WINFLAG_OPENREQ_ON_TOGGLESIZE 524288
#define LIMPX_WINFLAG_HAS_FOCUS 1048576
#define LIMPX_WINFLAG_FORCE_TOSCREEN 2097152
#define LIMPX_WINFLAG_HAS_BACKICON 1677216
#define LIMPX_WINFLAG_HAS_CLOSEICON 33554432
#define LIMPX_WINFLAG_HAS_TITLEBAR 67108864
#define LIMPX_WINFLAG_HAS_TOGGLE 134217728
#define LIMPX_WINFLAG_HAS_VERTBAR 268435456
#define LIMPX_WINFLAG_HAS_ADJUSTSIZE 536870912
#define LIMPX_WINFLAG_HAS_HORZBAR 107371824
#define LIMPX_WINFLAG_NEW_FORMAT 2147483648

/* Icon flags */
#define LIMPX_ICONFLAG_TEXT 1
#define LIMPX_ICONFLAG_SPRITE 2
#define LIMPX_ICONFLAG_BORDER 4
#define LIMPX_ICONFLAG_H_CENTER 8
#define LIMPX_ICONFLAG_V_CENTER 16
#define LIMPX_ICONFLAG_FILLED 32
#define LIMPX_ICONFLAG_FONT 64
#define LIMPX_ICONFLAG_NEEDS_REDRAW 128
#define LIMPX_ICONFLAG_INDIRECTED 256
#define LIMPX_ICONFLAG_RIGHT_JUSTIFY 512
#define LIMPX_ICONFLAG_ADJUST_DONT_CANCEL 1024
#define LIMPX_ICONFLAG_HALF_SPRITE 2048
#define LIMPX_ICONFLAG_BUTTON_TYPES 0xF000
#define LIMPX_ICONFLAG_ESG 0x1F0000
#define LIMPX_ICONFLAG_SELECTED 2097152
#define LIMPX_ICONFLAG_UNSELECTABLE 4194304
#define LIMPX_ICONFLAG_DELETED 8388608
#define LIMPX_ICONFLAG_FOR_COL 0xF000000
#define LIMPX_ICONFLAG_BACK_COL 0xF0000000
#define LIMPX_ICONFLAG_FONT_HANDLE 0xFF000000

/* Button types */
#define LIMPX_BUTTON_NONE 0
#define LIMPX_BUTTON_NOTIFY 1
#define LIMPX_BUTTON_CLICK_REPEAT 2
#define LIMPX_BUTTON_CLICK_NO_REPEAT 3
#define LIMPX_BUTTON_CLICK_SELECT 4
#define LIMPX_BUTTON_CLICK_DOUBLE 5
#define LIMPX_BUTTON_DRAGCLICK_NO_AUTO 6
#define LIMPX_BUTTON_DRAGCLICK_SELECT 7
#define LIMPX_BUTTON_DRAGCLICK_DOUBLE 8
#define LIMPX_BUTTON_MENU 9
#define LIMPX_BUTTON_CLICK_DRAG_DOUBLECLICK 10
#define LIMPX_BUTTON_CLICK_DRAG 11
#define LIMPX_BUTTON_DRAGGAIN_CARET 14
#define LIMPX_BUTTON_GAIN_CARET 15

/* Menu item flags */
#define LIMPX_MENUITEM_TICK 1
#define LIMPX_MENUITEM_DOTTED 2
#define LIMPX_MENUITEM_WRITEABLE 4
#define LIMPX_MENUITEM_MESSAGE 8
#define LIMPX_MENUITEM_ALWAYS_SUBMENU 16
#define LIMPX_MENUITEM_LAST 128
#define LIMPX_MENUITEM_TITLE_INDIRECTED 256

/* SlotSize ops */
#define LIMPX_SLOTSIZE_SETCURRENT 1
#define LIMPX_SLOTSIZE_SETNEXT 2
#define LIMPX_SLOTSIZE_READCURRENT 3
#define LIMPX_SLOTSIZE_READNEXT 4
#define LIMPX_SLOTSIZE_READFREE 5

/*

				STRUCTURES

*/
#ifndef __LIMPX_C

typedef void limpx_window; /* These are only meant to be handled as pointers, so typedef'ing to void should be OK */
typedef void limpx_icon;
typedef void limpx_menu;
typedef void limpx_event;

typedef struct {
	int code;
	int block[64];
} limpx_pollblock;

typedef struct
{
	int ro_handle; /* Window */
	int vminx,vminy,vmaxx,vmaxy; /* Just use obj_size's instead? */
	int scrollx,scrolly;
	int rminx,rminy,rmaxx,rmaxy;
} limpx_redraw_obj;

typedef struct
{
	int x,y;
	int buttons;
	int window; /* Need to also add lx object pointers */
	int icon;
} limpx_mouse_obj;

typedef struct
{
	int window;
	int icon;
	int x,y;
	int height;
	int index;
} limpx_caret_obj;

typedef struct
{
	int col[16];
	int border;
	int mouse[3];
} limpx_pal;

typedef struct
{
	int xmul;
	int ymul;
	int xdiv;
	int ydiv;
} limpx_scalefact;

typedef struct
{
	char col[16];
} limpx_coltran;

typedef struct
{
	int vminx,vminy,vmaxx,vmaxy;
	int scrollx,scrolly;
	int behind;
	int flags;
} limpx_window_state;

typedef struct {
	int vminx,vminy,vmaxx,vmaxy;
	int scrollx;
	int scrolly;
	int behind;
	int flags;
	char title_for,title_back,work_for,work_back;
	char scroll_outer,scroll_inner,title_focus,zero;
	int wminx,wminy,wmaxx,wmaxy;
	int title_flags;
	int work_flags;
	int sprite_block;
	int mins; /* Format 0xHHHHWWWW */
	int title[3]; /* Title data */
	int numicons;
} limpx_window_header;

typedef struct {
	int sminx,sminy,smaxx,smaxy;
	int flags;
	int data[3];
} limpx_icon_block;

typedef struct {
	char fonts[256];
	limpx_window_header *window;
} limpx_window_fheader;

/*

				FUNCTION PROTOTYPES

*/

#ifdef __cplusplus
extern "C"
{
#endif

extern int LimpX_Initialise(char *name);
extern void LimpX_OpenTemplate(char *name);
extern limpx_window_header *LimpX_LoadTemplate(char *name);
extern limpx_window_fheader *LimpX_LoadTemplateWithFonts(char *name);
extern void LimpX_KillTemplate(limpx_window_header *h);
extern void LimpX_KillTemplateWithFonts(limpx_window_fheader *h);
extern void LimpX_CloseTemplate();
extern limpx_window *LimpX_CreateWindow(limpx_window_header *block);
extern limpx_window *LimpX_CreateWindowWithFonts(limpx_window_fheader *h);
extern limpx_icon *LimpX_NewIcon(limpx_window *w,limpx_icon_block *block);
extern limpx_icon *LimpX_NewIconBarIcon(int pos,int priority,limpx_icon_block *block);
extern void LimpX_DeleteWindow(limpx_window *w);
extern void LimpX_DeleteIcon(limpx_icon *i);
extern void LimpX_OpenWindow(limpx_window *w);
extern void LimpX_OpenWindowAt(limpx_window *w,limpx_window_state p);
extern void LimpX_CloseWindow(limpx_window *w);
extern int LimpX_RedrawWindow(limpx_redraw_obj *r);
extern int LimpX_UpdateWindow(limpx_redraw_obj *r);
extern int LimpX_GetRectangle(limpx_redraw_obj *r);
extern limpx_window_state LimpX_GetWindowState(limpx_window *w);
extern limpx_window_header *LimpX_GetWindowInfo(limpx_window *w,int f);
extern void LimpX_SetIconState(limpx_icon *i,int e,int c);
extern void LimpX_GetIconState(limpx_icon *i,limpx_icon_block *b);
extern void LimpX_GetPointerInfo(limpx_mouse_obj *m);
extern void LimpX_DragBox(limpx_window *w,int type,int minx,int miny,int maxx,int maxy,int pminx,int pminy,int pmaxx,int pmaxy,int r12,int drawbox,int rembox,int movebox);
extern void LimpX_DragBoxBlk(int *block);
extern void LimpX_ForceRedraw(limpx_window *w,int minx,int miny,int maxx,int maxy);
extern void LimpX_SetCaretPosition(limpx_window *w,limpx_icon *i,int x,int y,int h,int p);
extern void LimpX_SetCaretPositionBlk(limpx_caret_obj *c);
extern void LimpX_GetCaretPosition(limpx_caret_obj *c);
extern limpx_menu *LimpX_NewMenu();
extern void LimpX_KillMenuItem(limpx_menu *m,int n);
extern void LimpX_KillMenu(limpx_menu *m);
extern void LimpX_UpdateMenuBlock(limpx_menu *m);
extern void LimpX_CreateMenu(limpx_menu *m,int x,int y);
extern void LimpX_CreateWindowAsMenu(limpx_window *w,int x,int y);
extern void LimpX_DecodeMenu(limpx_menu *m,void *sel,int *out);
extern void LimpX_WhichIcon(limpx_window *w,int *block,int mask,int settings);
extern void LimpX_SetExtent(limpx_window *w,int minx,int miny,int maxx,int maxy);
extern void LimpX_SetPointerShape(int n,void *d,int w,int h,int x,int y);
extern void LimpX_ProcessKey(int c);
extern void LimpX_CloseDown();
extern void LimpX_KillAll();
extern int LimpX_StartTask(char *cmd);
extern int LimpX_ReportError(int num,char *msg,int flags,char *title,char *spr,int blk,char *extra);
extern limpx_window_state LimpX_GetWindowOutline(limpx_window *w);
extern void LimpX_PlotIcon(limpx_icon_block *i);
extern void LimpX_SetMode(int m);
extern void LimpX_SetPalette(limpx_pal *p);
extern void LimpX_ReadPalette(limpx_pal *p);
extern void LimpX_SetColour(int c);
extern void LimpX_SendMessage(int code,void *b,int h,int i);
extern void LimpX_CreateSubMenu(limpx_menu *m,limpx_window *w,int x,int y);
extern int LimpX_ROMBaseOfSprites();
extern int LimpX_RMABaseOfSprites();
extern void LimpX_BlockCopy(limpx_window *w,int minx,int miny,int maxx,int maxy,int dx,int dy);
extern int LimpX_SlotSize(int op,int val);
extern void LimpX_ReadPixTrans(int flags,int area,int spr,limpx_scalefact *s,limpx_coltran *c);
extern void LimpX_CommandWindow(int o);
extern void LimpX_TextColour(int c);
extern void LimpX_TextOp_Colour(int f,int b);
extern int LimpX_TextOp_Width(char *str,int chars);
extern void LimpX_TextOp_Plot(int flags,char *str,int x,int y);
extern void LimpX_TransferBlock(int sh,void *sb,int dh,void *db,int l);
extern int LimpX_ReadSysInfo(int i,int *s);
extern void LimpX_SetFontColours(int b,int f);
extern void LimpX_GetMenuState(int t,int *b,int w,int i);
extern void LimpX_AddMessages(void *b);
extern void LimpX_RemoveMessages(void *b);
extern void LimpX_SetColourMapping(limpx_pal *p,char *two,char *four,char *sixteen);
extern limpx_pollblock *LimpX_Poll(int mask,void *w);
extern limpx_pollblock *LimpX_PollIdle(int mask,void *w,int time);
extern void LimpX_SetAbortFlag(int i);
extern int LimpX_GetAbortFlag();
extern limpx_window *LimpX_WindowFromHandle(int h);
extern limpx_icon *LimpX_IconFromHandle(int h,int i);
extern limpx_menu *LimpX_MenuFromHandle(void *h);
extern int LimpX_HandleFromWindow(limpx_window *w);
extern limpx_window *LimpX_WindowFromIcon(limpx_icon *i);
extern int LimpX_HandleFromIcon(limpx_icon *i);
extern int LimpX_HandleFromMenu(limpx_menu *m);
extern limpx_icon *LimpX_IconFromWindow(limpx_window *w,int i);
extern void LimpX_GetWindowHeader(limpx_window *w,limpx_window_header *h);
extern int LimpX_GetWindow_TitleFor(limpx_window *w);
extern int LimpX_GetWindow_TitleBack(limpx_window *w);
extern int LimpX_GetWindow_WorkFor(limpx_window *w);
extern int LimpX_GetWindow_WorkBack(limpx_window *w);
extern int LimpX_GetWindow_ScrollOuter(limpx_window *w);
extern int LimpX_GetWindow_ScrollInner(limpx_window *w);
extern int LimpX_GetWindow_TitleFocus(limpx_window *w);
extern int LimpX_GetWindow_WorkMinX(limpx_window *w);
extern int LimpX_GetWindow_WorkMinY(limpx_window *w);
extern int LimpX_GetWindow_WorkMaxX(limpx_window *w);
extern int LimpX_GetWindow_WorkMaxY(limpx_window *w);
extern int LimpX_GetWindow_TitleFlags(limpx_window *w);
extern int LimpX_GetWindow_WorkFlags(limpx_window *w);
extern int LimpX_GetWindow_SpriteBlock(limpx_window *w);
extern int LimpX_GetWindow_MinX(limpx_window *w);
extern int LimpX_GetWindow_MinY(limpx_window *w);
extern char *LimpX_GetWindow_Title(limpx_window *w);
extern char *LimpX_GetWindow_Validation(limpx_window *w);
extern int LimpX_GetWindow_TitleSpriteBlock(limpx_window *w);
extern int LimpX_GetWindow_TitleSpritePtr(limpx_window *w);
extern int LimpX_GetWindow_Icons(limpx_window *w);
extern void LimpX_SetWindow_TitleFor(limpx_window *w,int i);
extern void LimpX_SetWindow_TitleBack(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkFor(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkBack(limpx_window *w,int i);
extern void LimpX_SetWindow_ScrollOuter(limpx_window *w,int i);
extern void LimpX_SetWindow_ScrollInner(limpx_window *w,int i);
extern void LimpX_SetWindow_TitleFocus(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkMinX(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkMinY(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkMaxX(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkMaxY(limpx_window *w,int i);
extern void LimpX_SetWindow_TitleFlags(limpx_window *w,int i);
extern void LimpX_SetWindow_WorkFlags(limpx_window *w,int i);
extern void LimpX_SetWindow_SpriteBlock(limpx_window *w,int i);
extern void LimpX_SetWindow_MinX(limpx_window *w,int i);
extern void LimpX_SetWindow_MinY(limpx_window *w,int i);
extern void LimpX_SetWindow_Title(limpx_window *w,char *c);
extern void LimpX_SetWindow_Validation(limpx_window *w,char *c);
extern void LimpX_SetWindow_TitleSpriteBlock(limpx_window *w,int i);
extern void LimpX_SetWindow_TitleSpritePtr(limpx_window *w,int i);
extern void LimpX_RebuildTitleData(limpx_window *w);
extern int LimpX_GetIcon_MinX(limpx_icon *i);
extern int LimpX_GetIcon_MinY(limpx_icon *i);
extern int LimpX_GetIcon_MaxX(limpx_icon *i);
extern int LimpX_GetIcon_MaxY(limpx_icon *i);
extern int LimpX_GetIcon_Flags(limpx_icon *i);
extern char *LimpX_GetIcon_Text(limpx_icon *i);
extern char *LimpX_GetIcon_Validation(limpx_icon *i);
extern int LimpX_GetIcon_SpriteBlock(limpx_icon *i);
extern int LimpX_GetIcon_SpritePtr(limpx_icon *i);
extern int LimpX_GetIcon_Pos(limpx_icon *i);
extern int LimpX_GetIcon_Priority(limpx_icon *i);
extern int LimpX_GetIcon_TextLength(limpx_icon *i);
extern void LimpX_ResizeIcon(limpx_icon *i,int minx,int miny,int maxx,int maxy);
extern void LimpX_SetIcon_MinX(limpx_icon *i,int x);
extern void LimpX_SetIcon_MinY(limpx_icon *i,int x);
extern void LimpX_SetIcon_MaxX(limpx_icon *i,int x);
extern void LimpX_SetIcon_MaxY(limpx_icon *i,int x);
extern void LimpX_SetIcon_Flags(limpx_icon *i,int x);
extern void LimpX_SetIcon_Text(limpx_icon *i,char *c);
extern void LimpX_SetIcon_Validation(limpx_icon *i,char *c);
extern void LimpX_SetIcon_SpriteBlock(limpx_icon *i,int x);
extern void LimpX_SetIcon_SpritePtr(limpx_icon *i,int x);
extern void LimpX_SetIcon_Pos(limpx_icon *i,int x);
extern void LimpX_SetIcon_Priority(limpx_icon *i,int x);
extern void LimpX_SetIcon_TextLength(limpx_icon *i,int x);
extern void LimpX_RebuildIconData(limpx_icon *i);
extern void LimpX_RedrawIcon(limpx_icon *i);
extern char *LimpX_GetMenu_Text(limpx_menu *m);
extern char *LimpX_GetMenu_Validation(limpx_menu *m);
extern int LimpX_GetMenu_TitleFor(limpx_menu *m);
extern int LimpX_GetMenu_TitleBack(limpx_menu *m);
extern int LimpX_GetMenu_WorkFor(limpx_menu *m);
extern int LimpX_GetMenu_WorkBack(limpx_menu *m);
extern int LimpX_GetMenu_Width(limpx_menu *m);
extern int LimpX_GetMenu_Height(limpx_menu *m);
extern int LimpX_GetMenu_Gap(limpx_menu *m);
extern int LimpX_GetMenu_Flags(limpx_menu *m);
extern void LimpX_SetMenu_Text(limpx_menu *m,char *c);
extern void LimpX_SetMenu_Validation(limpx_menu *m,char *c);
extern void LimpX_SetMenu_TitleFor(limpx_menu *m,int i);
extern void LimpX_SetMenu_TitleBack(limpx_menu *m,int i);
extern void LimpX_SetMenu_WorkFor(limpx_menu *m,int i);
extern void LimpX_SetMenu_WorkBack(limpx_menu *m,int i);
extern void LimpX_SetMenu_Width(limpx_menu *m,int i);
extern void LimpX_SetMenu_Height(limpx_menu *m,int i);
extern void LimpX_SetMenu_Gap(limpx_menu *m,int i);
extern void LimpX_SetMenu_Flags(limpx_menu *m,int i);
extern char *LimpX_GetMenuItem_Text(limpx_menu *m,int i);
extern char *LimpX_GetMenuItem_Validation(limpx_menu *m,int i);
extern int LimpX_GetMenuItem_SpriteBlock(limpx_menu *m,int i);
extern int LimpX_GetMenuItem_SpritePtr(limpx_menu *m,int i);
extern int LimpX_GetMenuItem_ItemFlags(limpx_menu *m,int i);
extern int LimpX_GetMenuItem_IconFlags(limpx_menu *m,int i);
extern int LimpX_GetMenuItem_TextLength(limpx_menu *m,int i);
extern void LimpX_SetMenuItem_Text(limpx_menu *m,int i,char *c);
extern void LimpX_SetMenuItem_Validation(limpx_menu *m,int i,char *c);
extern void LimpX_SetMenuItem_SpriteBlock(limpx_menu *m,int i,int x);
extern void LimpX_SetMenuItem_SpritePtr(limpx_menu *m,int i,int x);
extern void LimpX_SetMenuItem_ItemFlags(limpx_menu *m,int i,int x);
extern void LimpX_SetMenuItem_IconFlags(limpx_menu *m,int i,int x);
extern void LimpX_SetMenuItem_TextLength(limpx_menu *m,int i,int x);
extern void LimpX_SetMenuItem_SubMenu(limpx_menu *m,int i,limpx_menu *s);
extern void LimpX_SetMenuItem_SubWindow(limpx_menu *m,int i,limpx_window *s);
extern void LimpX_SetMenuItem_ClearSub(limpx_menu *m,int i);
extern int LimpX_NewMenuItem(limpx_menu *m);
extern limpx_event *LimpX_NewEvent_Null_Code(int (*func) (void));
extern limpx_event *LimpX_NewEvent_Redraw_Window(int (*func) (limpx_window *win),limpx_window *w);
extern limpx_event *LimpX_NewEvent_Open_Window(int (*func) (limpx_window *win,limpx_window_state *pos),limpx_window *w);
extern limpx_event *LimpX_NewEvent_Close_Window(int (*func) (limpx_window *win),limpx_window *w);
extern limpx_event *LimpX_NewEvent_Pointer_Leave(int (*func) (limpx_window *win),limpx_window *w);
extern limpx_event *LimpX_NewEvent_Pointer_Enter(int (*func) (limpx_window *win),limpx_window *w);
extern limpx_event *LimpX_NewEvent_Mouse_Click(int (*func) (limpx_mouse_obj *mouse,limpx_window *win,limpx_icon *icon),limpx_window *win,limpx_icon *icon);
extern limpx_event *LimpX_NewEvent_Drag_Box(int (*func) (int minx,int miny,int maxx,int maxy));
extern limpx_event *LimpX_NewEvent_Key_Pressed(int (*func) (limpx_caret_obj *c,int key),limpx_window *win,limpx_icon *icon);
extern limpx_event *LimpX_NewEvent_Menu_Selection(int (*func) (int *selections));
extern limpx_event *LimpX_NewEvent_Scroll_Request(int (*func) (limpx_window *win,limpx_window_state *pos,int xdir,int ydir),limpx_window *win);
extern limpx_event *LimpX_NewEvent_Lose_Caret(int (*func) (limpx_caret_obj *c),limpx_window *win,limpx_icon *icon);
extern limpx_event *LimpX_NewEvent_Gain_Caret(int (*func) (limpx_caret_obj *c),limpx_window *win,limpx_icon *icon);
extern limpx_event *LimpX_NewEvent_Poll_NonZero(int (*func) (void));
extern limpx_event *LimpX_NewEvent_User_Message(int (*func) (int code,int *block),int msg);
extern limpx_event *LimpX_NewEvent_Other_Event(int (*func) (int code,int *block));
extern void LimpX_DeleteEvent(limpx_event *e);
extern void LimpX_SelectESGIcon(limpx_icon *i);
extern limpx_icon *LimpX_GetSelectedESGIcon(limpx_window *w,int esg);
extern void LimpX_DragASprite_Start(int flags,int area,char *name,int *box,int *bounds);
extern void LimpX_DragASprite_Stop();
extern void LimpX_UpdateCaret();

#ifdef __cplusplus
}
#endif

#endif

#endif
