/*===========================================================================*/
/*                                                                           */
/* File    : RCCOMP.H                                                        */
/*                                                                           */
/* Purpose : Include file for the resource compiler                          */
/*                                                                           */
/* History :                                                                 */
/*                                                                           */
/* (C) Copyright 1989 Marc Adler/Magma Systems     All Rights Reserved       */
/*===========================================================================*/

typedef struct resource
{
  BYTE  bResType;   /* 0 if iResType is a string-table offset - always 0xFF here */
  WORD  iResType;
#define RT_POINTER      1   /* mouse pointer shape */
#define RT_BITMAP       2   /* bitmap */
#define RT_MENU         3   /* menu template */
#define RT_DIALOG       4   /* dialog template */
#define RT_STRING       5   /* string tables */
#define RT_ACCELTABLE   8   /* accelerator tables */
#define RT_RCDATA       9   /* binary data */
#define RT_MESSAGE      10  /* error msg     tables */
#define RT_DLGINCLUDE   11  /* dialog include file name */
#define RT_VKEYTBL      12  /* key to vkey tables */

  BYTE  bResID;    /* 0 if iResID is a string-table offset - always 0xFF here */
  WORD  iResID;

  WORD  fResFlags;
#define RES_MOVEABLE     0x0010
#define RES_PRELOAD      0x0040
#define RES_DISCARDABLE  0x1000

  DWORD nResBytes;
  BYTE  szResData[1];
} RESOURCE;


typedef struct rcstring
{
  WORD idString;
  WORD nChars;
  BYTE string[1];
} RCSTRING;

typedef struct stringtable
{
  WORD nStrings;
  RCSTRING strings[1];
} STRINGTABLE;


typedef struct accel
{
  WORD key;
  WORD cmd;
} ACCEL;

typedef struct acceltable
{
  WORD nAccels;
  ACCEL  accels[1];
} ACCELTABLE;


typedef struct mti
{
  WORD style;
#define MF_POPUP      0x0040
#define MF_STRING     0x0080
#define MF_SEPARATOR  0x1000

  WORD attr;
#define MF_CHECKED		0x0100
#define MF_UNCHECKED	0x0200
#define MF_DISABLED 	0x0400
#define MF_ENABLED 	  0x0800

#define MF_MENUBREAK  0x2000
#define MF_MENUBARBREAK 0x4000
#define MF_SHADOW     0x4000
#define MF_HELP       0x8000

  WORD idItem;
#ifdef FOOBAZ
  union
  {
    struct item_string           /* MF_STRING     */
    {
      WORD nChars;
      char   string[1];
    };
    MENUTEMPLATE item_popup;     /* MF_POPUP      */
    void foo;                    /* MF_SEPARATEOR */
  } uItem;
#endif
} MTI;

typedef struct menutemplate
{
/*WORD nBytes;*/
  WORD nItems;
  MTI    items[1];
} MENUTEMPLATE;


typedef struct dlgitem
{
  WORD  class;
  WORD  id;
  WORD  x, y, cx, cy;
  WORD  attr;
  WORD  nChars;
  char    szTitle[1];
  DWORD   dwStyle;
} DLGITEM;

typedef struct dlgtemplate
{
  WORD  nItems;
  WORD  id;
  WORD  x, y, cx, cy;
  WORD  attr;
  DWORD   dwStyle;
  WORD  nChars;
  char    szTitle[1];
  DLGITEM items[1];
} DLGTEMPLATE;


BYTE *pascal DosGetResource(WORD hModule, WORD idType, WORD idName);
WORD pascal OpenResourceFile(char *szFileName);
void pascal CloseResourceFile(WORD hModule);
pascal LoadString(WORD hModule, WORD idStr, BYTE *pBuffer, WORD nMax);
HACCEL pascal LoadAccelerators(WORD hModule, WORD idAccel);
HMENU LoadMenu(WORD hModule, WORD idMenu, HWND hParent);
HDLG pascal LoadDialog(WORD hModule, WORD idDialog, HWND hParent, BOOL (pascal *dlgfunc)());

