home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / code / desklib / DeskLib / !DeskLib / h / Wimp < prev    next >
Encoding:
Text File  |  1995-07-29  |  13.7 KB  |  710 lines

  1.  
  2. #ifndef __dl_wimp_h
  3. #define __dl_wimp_h
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifndef __dl_core_h
  8. #include "Core.h"
  9. #endif
  10. #define wimp_MAXNAME 12
  11. typedef struct
  12. {
  13. int x, y;
  14. } wimp_point;
  15. typedef wimp_point wimp_coord;
  16. typedef struct
  17. {
  18. wimp_point min;
  19. wimp_point max;
  20. } wimp_rect;
  21. typedef wimp_rect wimp_box;
  22. typedef int window_handle;
  23. typedef int icon_handle;
  24. typedef int task_handle;
  25. #define colour_WHITE 0
  26. #define colour_GREY0 0
  27. #define colour_GREY1 1
  28. #define colour_GREY2 2
  29. #define colour_GREY3 3
  30. #define colour_GREY4 4
  31. #define colour_GREY5 5
  32. #define colour_GREY6 6
  33. #define colour_GREY7 7
  34. #define colour_BLACK 7
  35. #define colour_DARK_BLUE 8
  36. #define colour_YELLOW 9
  37. #define colour_GREEN 10
  38. #define colour_RED 11
  39. #define colour_CREAM 12
  40. #define colour_ARMY_GREEN 13
  41. #define colour_ORANGE 14
  42. #define colour_LIGHT_BLUE 15
  43. #define colour_TRANSPARENT 255 
  44. typedef union
  45. {
  46. int value;
  47. struct
  48. {
  49. unsigned int wimpcolour : 4;
  50. unsigned int gcolaction : 3;
  51. unsigned int foreback : 1;
  52. unsigned int padding : 24;
  53. } data;
  54. } wimp_colour;
  55. typedef union
  56. {
  57. int value;
  58. struct
  59. {
  60. char gcol;
  61. char red;
  62. char green;
  63. char blue;
  64. } data;
  65. } palette_entry;
  66. typedef struct
  67. {
  68. palette_entry colour[16];
  69. palette_entry border;
  70. palette_entry mouse1;
  71. palette_entry mouse2;
  72. palette_entry mouse3;
  73. } palette_block;
  74. #define iconbtype_NEVER 0
  75. #define iconbtype_ALWAYS 1
  76. #define iconbtype_AUTOREPEAT 2
  77. #define iconbtype_CLICK 3
  78. #define iconbtype_RELEASE 4
  79. #define iconbtype_DOUBLECLICK 5
  80. #define iconbtype_CLICKDRAG 6
  81. #define iconbtype_RELEASEDRAG 7
  82. #define iconbtype_DOUBLEDRAG 8
  83. #define iconbtype_MENU 9
  84. #define iconbtype_DOUBLECLICKDRAG 10
  85. #define iconbtype_RADIO 11
  86. #define iconbtype_RESERVED1 12
  87. #define iconbtype_RESERVED2 13
  88. #define iconbtype_WRITECLICKDRAG 14
  89. #define iconbtype_WRITABLE 15
  90. #define iconbar_RIGHT -1
  91. #define iconbar_LEFT -2
  92. #define window_ICONBAR -2
  93. #define icon_TEXT 0x00000001 
  94. #define icon_SPRITE 0x00000002 
  95. #define icon_BORDER 0x00000004 
  96. #define icon_HCENTRE 0x00000008 
  97. #define icon_VCENTRE 0x00000010 
  98. #define icon_FILLED 0x00000020 
  99. #define icon_FONT 0x00000040 
  100. #define icon_NEEDSHELP 0x00000080 
  101. #define icon_INDIRECTED 0x00000100 
  102. #define icon_RJUSTIFY 0x00000200 
  103. #define icon_ALLOWADJUST 0x00000400 
  104. #define icon_HALVESPRITE 0x00000800 
  105. #define icon_BUTTONTYPE 0x00001000 
  106. #define icon_SELECTED 0x00200000 
  107. #define icon_SHADED 0x00400000 
  108. #define icon_DELETED 0x00800000 
  109. #define icon_FORECOLOUR 0x01000000 
  110. #define icon_BACKCOLOUR 0x10000000 
  111. #define iconvalid_ALLOW 'A'
  112. #define iconvalid_BORDERTYPE 'R'
  113. #define iconvalid_DISPLAY 'D'
  114. #define iconvalid_FONTCOLOURS 'F'
  115. #define iconvalid_LINESPACE 'L'
  116. #define iconvalid_SPRITENAME 'S'
  117. #define iconborder_PLINTH 0
  118. #define iconborder_SURROUND 1
  119. #define iconborder_OKBUTTON 2
  120. #define iconborder_INDENT 3
  121. typedef union
  122. {
  123. unsigned int value;
  124. struct
  125. {
  126. unsigned int garbage1 : 6; 
  127. unsigned int font : 1; 
  128. unsigned int garbage2 : 17; 
  129. unsigned int handle : 8; 
  130. } font;
  131. struct
  132. {
  133. unsigned int text : 1;
  134. unsigned int sprite : 1;
  135. unsigned int border : 1;
  136. unsigned int hcentre : 1;
  137. unsigned int vcentre : 1;
  138. unsigned int filled : 1;
  139. unsigned int font : 1;
  140. unsigned int needshelp : 1;
  141. unsigned int indirected : 1;
  142. unsigned int rightjustify : 1;
  143. unsigned int allowadjust : 1;
  144. unsigned int halfsize : 1;
  145. unsigned int buttontype : 4;
  146. unsigned int esg : 5;
  147. unsigned int selected : 1;
  148. unsigned int shaded : 1;
  149. unsigned int deleted : 1;
  150. unsigned int foreground : 4;
  151. unsigned int background : 4;
  152. } data;
  153. } icon_flags;
  154. typedef struct
  155. {
  156. char *buffer;
  157. char *validstring;
  158. unsigned int bufflen;
  159. } icon_indtext;
  160. typedef struct
  161. {
  162. const char *name;
  163. void *spritearea;
  164. unsigned int nameisname;
  165. } icon_indsprite;
  166. typedef union
  167. {
  168. char text[wimp_MAXNAME];
  169. icon_indtext indirecttext;
  170. char spritename[wimp_MAXNAME];
  171. icon_indsprite indirectsprite;
  172. } icon_data;
  173. typedef struct
  174. {
  175. wimp_box workarearect;
  176. icon_flags flags;
  177. icon_data data;
  178. } icon_block;
  179. typedef struct
  180. {
  181. window_handle window;
  182. icon_block icondata;
  183. } icon_createblock;
  184. typedef union
  185. {
  186. struct
  187. {
  188. unsigned int hastitle : 1; 
  189. unsigned int moveable : 1;
  190. unsigned int hasvscroll : 1; 
  191. unsigned int hashscroll : 1; 
  192. unsigned int autoredraw : 1;
  193. unsigned int pane : 1;
  194. unsigned int nobounds : 1;
  195. unsigned int nobackclose : 1; 
  196. unsigned int scrollrq : 1;
  197. unsigned int scrollrqdebounced : 1;
  198. unsigned int realcolours : 1;
  199. unsigned int backwindow : 1;
  200. unsigned int hotkeys : 1;
  201. unsigned int keeponscreen : 1;
  202. unsigned int ignoreright : 1;
  203. unsigned int ignorebottom : 1;
  204. unsigned int open : 1;
  205. unsigned int top : 1;
  206. unsigned int fullsize : 1;
  207. unsigned int istoggling : 1;
  208. unsigned int focus : 1;
  209. unsigned int forceonce : 1;
  210. unsigned int dummy22 : 1;
  211. unsigned int dummy23 : 1;
  212. unsigned int backicon : 1;
  213. unsigned int closeicon : 1;
  214. unsigned int titlebar : 1;
  215. unsigned int toggleicon : 1;
  216. unsigned int vscroll : 1;
  217. unsigned int adjusticon : 1;
  218. unsigned int hscroll : 1;
  219. unsigned int newflags : 1; 
  220. } data;
  221. int value;
  222. } window_flags;
  223. typedef struct 
  224. int x : 16; 
  225. int y : 16; 
  226. } window_minsize;
  227. typedef enum
  228. {
  229. windowcol_TITLEFORE = 0,
  230. windowcol_TITLEBACK,
  231. windowcol_WORKFORE,
  232. windowcol_WORKBACK,
  233. windowcol_SCROLLBACK,
  234. windowcol_SCROLLFORE,
  235. windowcol_TITLEHILITE
  236. } window_colourindices;
  237. typedef struct
  238. {
  239. wimp_box screenrect;
  240. wimp_point scroll;
  241. window_handle behind;
  242. window_flags flags;
  243. char colours[8];
  244. wimp_box workarearect;
  245. icon_flags titleflags;
  246. icon_flags workflags;
  247. void *spritearea;
  248. window_minsize minsize;
  249. icon_data title;
  250. unsigned int numicons;
  251. } window_block;
  252. typedef struct
  253. {
  254. window_handle window;
  255. wimp_box screenrect;
  256. wimp_point scroll;
  257. window_handle behind;
  258. } window_openblock;
  259. typedef struct
  260. {
  261. window_openblock openblock;
  262. window_flags flags;
  263. } window_state;
  264. typedef struct
  265. {
  266. window_handle window;
  267. window_block block;
  268. } window_info;
  269. typedef struct
  270. {
  271. window_handle window;
  272. wimp_box rect;
  273. wimp_point scroll;
  274. wimp_box cliprect;
  275. } window_redrawblock;
  276. typedef struct
  277. {
  278. window_handle window;
  279. wimp_box screenrect;
  280. } window_outline;
  281. #define button_ADJUST 0x00000001
  282. #define button_MENU 0x00000002
  283. #define button_SELECT 0x00000004
  284. #define button_DRAGADJUST 0x00000010
  285. #define button_DRAGSELECT 0x00000040
  286. #define button_CLICKADJUST 0x00000100
  287. #define button_CLICKSELECT 0x00000400
  288. typedef union
  289. {
  290. unsigned int value;
  291. struct
  292. {
  293. unsigned int adjust : 1;
  294. unsigned int menu : 1;
  295. unsigned int select : 1;
  296. unsigned int dummy3 : 1;
  297. unsigned int dragadjust : 1;
  298. unsigned int dummy5 : 1;
  299. unsigned int dragselect : 1;
  300. unsigned int dummy7 : 1;
  301. unsigned int clickadjust : 1;
  302. unsigned int dummy9 : 1;
  303. unsigned int clickselect : 1;
  304. } data;
  305. } button_state;
  306. typedef struct
  307. {
  308. wimp_point pos;
  309. button_state button;
  310. window_handle window;
  311. icon_handle icon;
  312. } mouse_block;
  313. typedef struct
  314. {
  315. int shapenumber;
  316. char *shapedata;
  317. unsigned int width;
  318. unsigned int height;
  319. wimp_point active;
  320. } pointer_shapeblock;
  321. typedef enum
  322. {
  323. drag_MOVEWINDOW = 1,
  324. drag_RESIZEWINDOW,
  325. drag_SCROLLX,
  326. drag_SCROLLY,
  327. drag_FIXEDBOX,
  328. drag_RUBBERBOX,
  329. drag_INVISIBLE,
  330. drag_USERFIXEDBBOX,
  331. drag_USERRUBBERBOX,
  332. drag_USERFIXEDNC,
  333. drag_USERRUBBERNC
  334. } drag_type;
  335. typedef struct
  336. {
  337. window_handle window;
  338. drag_type type;
  339. wimp_box screenrect;
  340. wimp_box parent;
  341. } drag_block;
  342. typedef union
  343. {
  344. unsigned int value;
  345. struct
  346. {
  347. unsigned int ok : 1;
  348. unsigned int cancel : 1;
  349. unsigned int highlightcancel : 1;
  350. unsigned int noprompt : 1;
  351. unsigned int noprefix : 1;
  352. unsigned int nowait : 1;
  353. unsigned int closebox : 1;
  354. } data;
  355. } error_flags;
  356. typedef struct menu_block *menu_ptr;
  357. typedef union
  358. {
  359. unsigned int value;
  360. struct
  361. {
  362. unsigned int ticked : 1;
  363. unsigned int dotted : 1;
  364. unsigned int writable : 1;
  365. unsigned int notifysub : 1;
  366. unsigned int openshaded : 1;
  367. unsigned int dummy2 : 2;
  368. unsigned int last : 1;
  369. unsigned int indtitle : 1;
  370. unsigned int dummy13 : 13;
  371. unsigned int shaded : 1;
  372. unsigned int dummy1 : 1;
  373. unsigned int foreground : 4;
  374. unsigned int background : 4;
  375. } data;
  376. } menu_flags;
  377. typedef union
  378. {
  379. menu_ptr menu;
  380. window_handle window;
  381. int value;
  382. } menu_submenu;
  383. typedef struct
  384. {
  385. menu_flags menuflags;
  386. menu_submenu submenu;
  387. icon_flags iconflags;
  388. icon_data icondata;
  389. } menu_item;
  390. typedef struct menu_block
  391. {
  392. char title [wimp_MAXNAME];
  393. char titlefore, titleback, workfore, workback;
  394. unsigned int width;
  395. unsigned int height;
  396. unsigned int gap;
  397. } menu_block;
  398. typedef int key_press;
  399. typedef struct
  400. {
  401. window_handle window;
  402. icon_handle icon;
  403. wimp_point offset;
  404. int height;
  405. int index;
  406. } caret_block;
  407. typedef struct
  408. {
  409. caret_block caret;
  410. key_press code;
  411. } key_block;
  412. typedef struct
  413. {
  414. int address;
  415. int contents;
  416. } pollword_block;
  417. typedef enum
  418. {
  419. message_QUIT = 0,
  420. message_CLOSEDOWN = 0,
  421. message_DATASAVE = 1,
  422. message_DATASAVEACK = 2,
  423. message_DATASAVEOK = 2,
  424. message_DATALOAD = 3,
  425. message_DATALOADACK = 4,
  426. message_DATALOADOK = 4,
  427. message_DATAOPEN,
  428. message_RAMFETCH,
  429. message_RAMTRANSMIT,
  430. message_PREQUIT,
  431. message_PALETTECHANGE,
  432. message_SAVEDESK,
  433. message_DEVICECLAIM,
  434. message_DEVICEINUSE,
  435. message_DATASAVED,
  436. message_FILEROPENDIR = 0x400,
  437. message_FILERCLOSEDIR,
  438. message_FILEROPENDIRAT,
  439. message_FILERSELECTIONDIRECTORY,
  440. message_FILERADDSELECTION,
  441. message_FILERACTION,
  442. message_FILERCONTROLACTION,
  443. message_FILERSELECTION,
  444. message_HELPREQUEST = 0x502,
  445. message_HELPREPLY,
  446. message_NOTIFY = 0x40040,
  447. message_MENUWARNING = 0x400C0,
  448. message_MENUWARN = 0x400C0,
  449. message_MODECHANGE,
  450. message_TASKINITIALISE = 0x400C2,
  451. message_INITTASK = 0x400C2,
  452. message_TASKCLOSEDOWN = 0x400C3,
  453. message_CLOSETASK = 0x400C3,
  454. message_SLOTSIZE = 0x400C4,
  455. message_SLOTCHANGE = 0x400C4,
  456. message_SETSLOT = 0x400C5,
  457. message_TASKNAMERQ,
  458. message_TASKNAMEIS,
  459. message_TASKSTARTED,
  460. message_MENUSDELETED, 
  461. message_WINDOWINFO = 0x400CC, 
  462. message_POPUPRQ = 0x46D40, 
  463. message_POPUPREQUEST = 0x46D40,
  464. message_POPUPSTATE,
  465. message_POPUPCLOSED,
  466. message_PRINTFILE = 0x80140,
  467. message_WILLPRINT,
  468. message_PRINTSAVE,
  469. message_PRINTINIT,
  470. message_PRINTERROR,
  471. message_PRINTTYPEODD,
  472. message_PRINTTYPEKNOWN,
  473. message_SETPRINTER,
  474. message_PSPRINTERQUERY = 0x8014c,
  475. message_PSPRINTERACK,
  476. message_PSPRINTERMODIFIED,
  477. message_PSPRINTERDEFAULTS,
  478. message_PSPRINTERDEFAULTED,
  479. message_PSPRINTERNOTPS,
  480. message_RESETPRINTER,
  481. message_PSISFONTPRINTRUNNING,
  482. message_TASKWINDOW_INPUT = 0x808c0,
  483. message_TASKWINDOW_OUTPUT,
  484. message_TASKWINDOW_EGO,
  485. message_TASKWINDOW_MORIO,
  486. message_TASKWINDOW_MORITE,
  487. message_TASKWINDOW_NEWTASK,
  488. message_TASKWINDOW_SUSPEND,
  489. message_TASKWINDOW_RESUME
  490. } message_action;
  491. typedef int message_destinee; 
  492. typedef struct
  493. {
  494. unsigned int size;
  495. task_handle sender;
  496. unsigned int myref;
  497. unsigned int yourref;
  498. message_action action;
  499. } message_header;
  500. typedef struct
  501. {
  502. window_handle window;
  503. icon_handle icon;
  504. wimp_point pos;
  505. int estsize;
  506. int filetype;
  507. char leafname[12];
  508. } message_datasave;
  509. typedef struct
  510. {
  511. window_handle window; 
  512. icon_handle icon; 
  513. wimp_point pos;
  514. int estsize;
  515. int filetype;
  516. char filename[212];
  517. } message_datasaveack;
  518. typedef struct
  519. {
  520. window_handle window;
  521. icon_handle icon;
  522. wimp_point pos;
  523. int size;
  524. int filetype;
  525. char filename[212];
  526. } message_dataload;
  527. typedef struct 
  528. {
  529. window_handle window;
  530. icon_handle icon;
  531. wimp_point pos;
  532. int size;
  533. int filetype;
  534. char filename[212];
  535. } message_dataloadack;
  536. typedef message_dataload message_dataopen;
  537. typedef struct
  538. {
  539. char *buffer;
  540. int buffsize;
  541. } message_ramfetch;
  542. typedef struct
  543. {
  544. char *buffer; 
  545. int byteswritten;
  546. } message_ramtransmit;
  547. typedef struct
  548. {
  549. mouse_block where; 
  550. } message_helprequest;
  551. typedef struct
  552. {
  553. char text[200];
  554. } message_helpreply;
  555. typedef struct
  556. {
  557. int filler[5];
  558. int filetype;
  559. char filename[212];
  560. } message_print;
  561. typedef struct
  562. {
  563. int id; 
  564. wimp_point openpos; 
  565. int selection[10]; 
  566. } message_menuwarn;
  567. typedef struct
  568. {
  569. window_handle window;
  570. task_handle task;
  571. char title[20];
  572. } message_iconize;
  573. typedef struct
  574. {
  575. window_handle window;
  576. int dummy;
  577. char spritename[8];
  578. char title[20];
  579. } message_windowinfo;
  580. typedef struct
  581. {
  582. message_header header;
  583. union
  584. {
  585. char bytes [236];
  586. int words [59];
  587. message_datasave datasave;
  588. message_datasaveack datasaveack;
  589. message_dataload dataload;
  590. message_dataopen dataopen;
  591. message_ramfetch ramfetch;
  592. message_ramtransmit ramtransmit;
  593. message_helprequest helprequest;
  594. message_helpreply helpreply;
  595. message_print print;
  596. message_menuwarn menuwarn;
  597. message_iconize iconize;
  598. message_windowinfo windowinfo;
  599. #if FALSE
  600. message_popuprequest popuprequest; 
  601. message_popupstate popupstate; 
  602. #endif
  603. } data;
  604. } message_block;
  605. #define wimp_NUMBEROFEVENTS 20
  606. typedef enum
  607. {
  608. event_ANY = -99, 
  609. event_NULL = 0,
  610. event_REDRAW,
  611. event_OPEN,
  612. event_CLOSE,
  613. event_PTRLEAVE,
  614. event_PTRENTER,
  615. event_CLICK = 6,
  616. event_BUTTON = 6,
  617. event_USERDRAG,
  618. event_KEY,
  619. event_MENU,
  620. event_SCROLL,
  621. event_LOSECARET,
  622. event_GAINCARET,
  623. event_NONZEROPOLLWORD,
  624. event_USERMESSAGE = 17,
  625. event_SEND = 17,
  626. event_USERMESSAGERECORDED = 18,
  627. event_SENDWANTACK = 18,
  628. event_USERMESSAGEACK = 19,
  629. event_ACK = 19
  630. } event_type;
  631. typedef union
  632. {
  633. unsigned int value;
  634. struct
  635. {
  636. unsigned int null : 1;
  637. unsigned int redraw : 1;
  638. unsigned int open : 1;
  639. unsigned int close : 1;
  640. unsigned int ptrleave : 1;
  641. unsigned int ptrenter : 1;
  642. unsigned int click : 1;
  643. unsigned int userdrag : 1;
  644. unsigned int key : 1;
  645. unsigned int menu : 1;
  646. unsigned int scroll : 1;
  647. unsigned int losecaret : 1;
  648. unsigned int gaincaret : 1;
  649. unsigned int nonzeropollword : 1;
  650. unsigned int dummy14 : 1;
  651. unsigned int dummy15 : 1;
  652. unsigned int dummy16 : 1;
  653. unsigned int usermessage : 1;
  654. unsigned int usermessagerecorded : 1;
  655. unsigned int usermessageack : 1;
  656. unsigned int dummy20 : 1;
  657. unsigned int dummy21 : 1;
  658. unsigned int r3ispollwordptr : 1;
  659. unsigned int highprioritypoll : 1;
  660. unsigned int keepfpregisters : 1;
  661. } data;
  662. } event_pollmask;
  663. typedef struct
  664. {
  665. window_openblock openblock;
  666. wimp_point direction;
  667. } scroll_rq;
  668. typedef union
  669. {
  670. caret_block caret;
  671. key_block key;
  672. pollword_block pollword;
  673. window_openblock openblock;
  674. message_block message;
  675. mouse_block mouse;
  676. wimp_box screenrect;
  677. int selection[10];
  678. scroll_rq scroll;
  679. char bytes [256];
  680. int words [64];
  681. } event_data;
  682. typedef struct
  683. {
  684. event_type type;
  685. event_data data;
  686. } event_pollblock;
  687. typedef struct
  688. {
  689. char fonts[256];
  690. } font_array;
  691. typedef struct
  692. {
  693. window_block *buffer;
  694. char *workfree;
  695. char *workend;
  696. font_array *font;
  697. char *name;
  698. unsigned int index;
  699. } template_block;
  700. typedef struct
  701. {
  702. wimp_point mul;
  703. wimp_point div;
  704. } scale_block;
  705. #ifdef __cplusplus
  706. }
  707. #endif
  708. #endif
  709.