home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / m / makedrawf / !Drawf / Source / h / wimp < prev   
Encoding:
Text File  |  1995-06-05  |  4.8 KB  |  196 lines

  1. #ifndef _inc__wimp
  2. #define _inc__wimp
  3.  
  4. enum {
  5.   err_OKbox=1,        err_Cancelbox=2,
  6.   err_hlCancel=4,    err_noprompt=8,
  7.   err_noErrorFrom=16,    err_returnatonce=32,
  8.   err_force=64,        err_nobeep=128
  9. };
  10.  
  11. enum {
  12.   reason_null=0,    reason_redraw=1,
  13.   reason_open=2,    reason_close=3,
  14.   reason_ptr_leaving=4,    reason_ptr_entering=5,
  15.   reason_click=6,    reason_dragbox=7,
  16.   reason_key=8,        reason_menu=9,
  17.   reason_scroll=10,    reason_losecaret=11,
  18.   reason_gaincaret=12,    reason_pw_non0=13,
  19.   reason_message=17,    reason_message_rec=18,
  20.   reason_message_ack=19
  21. };
  22.  
  23. enum {
  24.   mask_null=1,        mask_redraw=2,
  25.   mask_ptr_leaving=16,    mask_ptr_entering=32,
  26.   mask_click=64,    mask_key=256,
  27.   mask_losecaret=1<<11,    mask_gaincaret=1<<12,
  28.   mask_pw_non0=1<<13,    mask_message=1<<17,
  29.   mask_message_rec=1<<18,
  30.   mask_message_ack=1<<19,
  31.   mask_pw_highpriority=1<<23,
  32.   mask_preserve_fpregs=1<<24
  33. };
  34.  
  35. typedef unsigned int uint;
  36.  
  37. typedef struct {
  38.   int num;
  39.   char str[252];
  40. } error_block;
  41.  
  42. typedef struct {
  43.   int num;
  44.   char str[56];
  45. } short_error_block;
  46.  
  47. #define err_block(N) struct { int num; char str[N]; }
  48.  
  49. typedef struct {
  50.   int x0; int y0;
  51.   int x1; int y1;
  52. } Box;
  53.  
  54. typedef struct {
  55.   int x; int y;
  56. } Pair;
  57.  
  58. typedef union {
  59.   int val;
  60.   struct {
  61.     uint text    : 1;
  62.     uint sprite  : 1;
  63.     uint border  : 1;
  64.     uint hcentre : 1;
  65.     uint vcentre : 1;
  66.     uint filled  : 1;
  67.     uint antialiased : 1;
  68.     uint needshelp   : 1;
  69.     uint indirected  : 1;
  70.     uint rjustify    : 1;
  71.     uint multiple    : 1;    /* Adjust, don't cancel others in ESG */
  72.     uint halfsize    : 1;
  73.     uint buttontype  : 4;
  74.     uint ESG     : 5;
  75.     uint selected    : 1;
  76.     uint shaded  : 1;
  77.     uint deleted : 1;
  78.     uint fg : 4;    /* this & bg combine to form a font number sometimes */
  79.     uint bg : 4;
  80.   } bits;
  81. } Icon_flags;
  82.  
  83. typedef union {
  84.   char text[12];
  85.   char name[12];
  86.   struct id_text {
  87.     char *text;
  88.     char *valid;
  89.     uint length; } indtext;
  90.   struct id_sprite {
  91.     char *name;    /* or may be pointer to sprite itself */
  92.     int *area;
  93.     int length; } indsprite;
  94. } Icon_data;
  95.  
  96. typedef struct {
  97.   Box bbox;
  98.   Icon_flags flags;
  99.   Icon_data data;
  100. } Icon_block;
  101.  
  102. typedef struct {
  103.   int window;
  104.   Icon_block block;
  105. } Icon_info;    /* this is what's needed by Wimp_CreateIcon */
  106.  
  107. typedef struct {
  108.   union {
  109.     int val;
  110.     struct {
  111.       uint ticked    : 1;
  112.       uint ruleafter : 1;
  113.       uint writable  : 1;
  114.       uint message   : 1;
  115.       uint greyopen  : 1;
  116.       uint zog1      : 2;
  117.       uint last      : 1;
  118.       uint indirect  : 1;
  119.       uint zog2      : 23; } bits; } flags;
  120.   union {
  121.     int window;
  122.     struct menu_block *submenu;   } leads_to;
  123.   Icon_flags                        icon_flags;
  124.   Icon_data                         icon_data;
  125. } Menu_item;
  126.  
  127. typedef struct menu_block {
  128.   Icon_data title;
  129.   char titlefg,titlebg,fg,bg;
  130.   int width,height,gap;
  131.   Menu_item items[1];    /* of course there will usually be more than 1 */
  132. } Menu_block;
  133.  
  134. #define mblock(N) struct {\
  135.   Icon_data title;\
  136.   char titlefg,titlebg,fg,bg;\
  137.   int width,height,gap;\
  138.   Menu_item items[N]; }
  139.  
  140. /* From s.wimp1: */
  141. extern int (*wimpfns[20])(int,int*);
  142. extern int task_handle, last_reason;
  143. int wimp_poll(int mask);
  144. int wimp_poll22(int mask, int *pollwordp);
  145. int wimp_pollidle(int mask, int time);
  146. int wimp_pollidle22(int mask, int time, int *pollwordp);
  147. int wimp_redrawwindow(int *block);
  148. int wimp_getrectangle(int *block);
  149. int wimp_openwindow(int *block);
  150. int wimp_closewindow(int *block);
  151. int wimp_processkey(int keycode);
  152. int wimp_initialise(int lastvsn, const char *desc, const int *msgs);
  153. int wimp_createwindow(int *block);
  154. void wimp_closedown(void);
  155. int wimp_reporterror(const void *block, int flags, const char *appname);
  156. /* first arg really error_block. Hack to allow short error blocks. */
  157. void wimp_createmenu(Menu_block *block, int x, int y);
  158. void wimp_closemenu(void);
  159.  
  160. /* From s.wimp2: */
  161. int wimp_opentemplate(const char *filename);
  162. void wimp_closetemplate(void);
  163. int wimp_xtemplate(const char *name, int *sizep, int *indsizep,
  164.                    int index, char **namep);
  165. int wimp_loadtemplate(const char *name, void *buffer, void *indirect,
  166.                       int indsize, char *fonts, int index, char **namep);
  167.  
  168. /* From s.wimp3: */
  169. int wimp_createicon(int priority, Icon_info *icon_info);
  170. int wimp_deleteicon(int window, int icon);
  171. Icon_block *wimp_geticonstate(int window, int icon);
  172. void wimp_seticonstate(int window, int icon, int eor, int clear);
  173.  
  174. /* From s.wimp4: */
  175. int wimp_sendmessage(int reason, int *block, int handle);
  176. int wimp_sendmessage4(int reason, int *block, int window, int icon);
  177. int wimp_starttask(const char *cmd);
  178.  
  179. /* From s.wimp5: */
  180. void begin_drag(int window, Icon_block *block);
  181. void end_drag(void);
  182. void wimp_getpointerinfo(int *block);
  183.  
  184. /* From s.wimp6: */
  185. void wimp_getwindowinfo(int *block);
  186.  
  187. /* From s.wimp7: */
  188. void wimp_getmenustate0(int *block);
  189.  
  190. /* From s.hglass: */
  191. void hourglass_on(void);
  192. void hourglass_off(void);
  193. void hourglass_start(int delay);
  194.  
  195. #endif
  196.