#ifndef wimp_h
#define wimp_h


typedef struct
{
  char* title;
  char* valid;
  int len;
  char title_fore;
  char title_back;
  char work_fore;
  char work_back;
  int width;
  int height;
  int gap;
} menu_block_t;


typedef struct
{
  int item_flags;
  int sub;
  int icon_flags;
  char *text;
  char *val;
  int len;
} menu_item_t;

typedef struct
{
  menu_block_t hdr;
  menu_item_t  items[];
} menu_t;

typedef struct
{
  /* control block */
  int area_size;   /* size of area in bytes */
  int num;         /* number of sprites in file */
  int offset;      /* offset to 1st sprite */
  int size_1;      /* offset to 1st free word */
  /* sprite */
  int size_2;      /* offset to next sprite */
  char name[12];   /* sprite name */
  int width;       /* width in words -1 */
  int height;      /* height in lines - 1 */
  int first;       /* first bit used (left) */
  int last;        /* last bit used (right) */
  int s_offset;    /* offset to sprite image */
  int m_offset;    /* offset to mask, or sprite if none */
  int mode;        /* sprite type */
} sprite_header_t;

typedef struct
{
  int x0;
  int y0;
  int x1;
  int y1;
} wimp_rect_t;

typedef struct
{
  int x;
  int y;
} wimp_point_t;

typedef struct
{
  int          window;
  wimp_rect_t  vis;
  wimp_point_t scroll;
  wimp_rect_t  in;
} wimp_redraw_t;

typedef struct
{
  int          window;
  wimp_rect_t  vis;
  wimp_point_t scroll;
  int          behind;
} window_open_t;

typedef struct
{
  int          window;
  wimp_rect_t  vis;
  wimp_point_t scroll;
  int          behind;
  int          flags;
} window_state_t;

typedef struct
{
  wimp_point_t pos;
  int          button;
  int          window;
  int          icon;
} wimp_mouse_t;

// icon flags
#define IC_SELECTED  (1<<21)
#define IC_SHADED    (1<<22)

/* message numbers */
#define MESSAGE_QUIT          0
#define MESSAGE_DATASAVE      1
#define MESSAGE_DATASAVEACK   2
#define MESSAGE_DATALOAD      3
#define MESSAGE_PALETTECHANGE 9
#define MESSAGE_HELPREQUEST   0x502
#define MESSAGE_HELPREPLY     0x503
#define MESSAGE_MENUWARNING   0x400c0
#define MESSAGE_MODECHANGE    0x400c1
#define MESSAGE_MENUDELETED   0x400c9

/* filetypes */
#define FILETYPE_TEXT        0xfff
#define FILETYPE_SPRITE      0xff9
#define FILETYPE_AVI         0xfb2
#define FILETYPE_WAVE        0xfb1
#define FILETYPE_MPEG        0xbf8
#define FILETYPE_AC3         0xa8f
#define FILETYPE_VOB         0xa8d
#define FILETYPE_ADTS        0xa62
#define FILETYPE_AMPEG       0x1ad

/* OS_file bits */
#define READ_CATINFO    17
#define WRITE_CATINFO   18
#define IS_FILE         1


#endif
