home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / intuition / intuition.h next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  39.3 KB  |  1,028 lines

  1. #ifndef INTUITION_INTUITION_H
  2. #define INTUITION_INTUITION_H
  3. /*
  4. **    $Filename: intuition/intuition.h $
  5. **    $Release: 1.3 $
  6. **
  7. **    main intuition include 
  8. **
  9. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include "exec/types.h"
  15. #endif
  16.  
  17. #ifndef GRAPHICS_GFX_H
  18. #include "graphics/gfx.h"
  19. #endif
  20.  
  21. #ifndef GRAPHICS_CLIP_H
  22. #include "graphics/clip.h"
  23. #endif
  24.  
  25. #ifndef GRAPHICS_VIEW_H
  26. #include "graphics/view.h"
  27. #endif
  28.  
  29. #ifndef GRAPHICS_RASTPORT_H
  30. #include "graphics/rastport.h"
  31. #endif
  32.  
  33. #ifndef GRAPHICS_LAYERS_H
  34. #include "graphics/layers.h"
  35. #endif
  36.  
  37. #ifndef GRAPHICS_TEXT_H
  38. #include "graphics/text.h"
  39. #endif
  40.  
  41. #ifndef EXEC_PORTS_H
  42. #include "exec/ports.h"
  43. #endif
  44.  
  45. #ifndef DEVICES_TIMER_H
  46. #include "devices/timer.h"
  47. #endif
  48.  
  49. #ifndef DEVICES_INPUTEVENT_H
  50. #include "devices/inputevent.h"
  51. #endif
  52.  
  53.  
  54. /* ======================================================================== */
  55. /* === Menu =============================================================== */
  56. /* ======================================================================== */
  57. struct Menu
  58. {
  59.     struct Menu *NextMenu;    /* same level */
  60.     SHORT LeftEdge, TopEdge;    /* position of the select box */
  61.     SHORT Width, Height;    /* dimensions of the select box */
  62.     USHORT Flags;        /* see flag definitions below */
  63.     BYTE *MenuName;        /* text for this Menu Header */
  64.     struct MenuItem *FirstItem; /* pointer to first in chain */
  65.  
  66.     /* these mysteriously-named variables are for internal use only */
  67.     SHORT JazzX, JazzY, BeatX, BeatY;
  68. };
  69.  
  70.  
  71. /* FLAGS SET BY BOTH THE APPLIPROG AND INTUITION */
  72. #define MENUENABLED 0x0001    /* whether or not this menu is enabled */
  73.  
  74. /* FLAGS SET BY INTUITION */
  75. #define MIDRAWN 0x0100        /* this menu's items are currently drawn */
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. /* ======================================================================== */
  83. /* === MenuItem =========================================================== */
  84. /* ======================================================================== */
  85. struct MenuItem 
  86.     struct MenuItem *NextItem;    /* pointer to next in chained list */ 
  87.     SHORT LeftEdge, TopEdge;    /* position of the select box */ 
  88.     SHORT Width, Height;    /* dimensions of the select box */ 
  89.     USHORT Flags;        /* see the defines below */ 
  90.  
  91.     LONG MutualExclude;        /* set bits mean this item excludes that */ 
  92.  
  93.     APTR ItemFill;        /* points to Image, IntuiText, or NULL */ 
  94.  
  95.     /* when this item is pointed to by the cursor and the items highlight 
  96.      *    mode HIGHIMAGE is selected, this alternate image will be displayed 
  97.      */ 
  98.     APTR SelectFill;        /* points to Image, IntuiText, or NULL */
  99.  
  100.     BYTE Command;        /* only if appliprog sets the COMMSEQ flag */
  101.  
  102.     struct MenuItem *SubItem;    /* if non-zero, DrawMenu shows "->" */
  103.  
  104.     /* The NextSelect field represents the menu number of next selected 
  105.      *    item (when user has drag-selected several items)
  106.      */
  107.     USHORT NextSelect;
  108. };
  109.  
  110.  
  111. /* FLAGS SET BY THE APPLIPROG */ 
  112. #define CHECKIT        0x0001    /* whether to check this item if selected */ 
  113. #define ITEMTEXT    0x0002    /* set if textual, clear if graphical item */ 
  114. #define COMMSEQ        0x0004    /* set if there's an command sequence */ 
  115. #define MENUTOGGLE    0x0008    /* set to toggle the check of a menu item */ 
  116. #define ITEMENABLED    0x0010    /* set if this item is enabled */ 
  117.  
  118. /* these are the SPECIAL HIGHLIGHT FLAG state meanings */ 
  119. #define HIGHFLAGS    0x00C0    /* see definitions below for these bits */ 
  120. #define HIGHIMAGE    0x0000    /* use the user's "select image" */ 
  121. #define HIGHCOMP    0x0040    /* highlight by complementing the selectbox */
  122. #define HIGHBOX        0x0080    /* highlight by "boxing" the selectbox */ 
  123. #define HIGHNONE    0x00C0    /* don't highlight */ 
  124.  
  125. /* FLAGS SET BY BOTH APPLIPROG AND INTUITION */ 
  126. #define CHECKED        0x0100    /* if CHECKIT, then set this when selected */ 
  127.  
  128. /* FLAGS SET BY INTUITION */ 
  129. #define ISDRAWN        0x1000    /* this item's subs are currently drawn */ 
  130. #define HIGHITEM    0x2000    /* this item is currently highlighted */ 
  131. #define MENUTOGGLED    0x4000    /* this item was already toggled */ 
  132.  
  133.  
  134.  
  135.  
  136.  
  137. /* ======================================================================== */
  138. /* === Requester ========================================================== */
  139. /* ======================================================================== */
  140. struct Requester
  141. {
  142.     /* the ClipRect and BitMap and used for rendering the requester */
  143.     struct Requester *OlderRequest;
  144.     SHORT LeftEdge, TopEdge;        /* dimensions of the entire box */
  145.     SHORT Width, Height;        /* dimensions of the entire box */
  146.     SHORT RelLeft, RelTop;        /* for Pointer relativity offsets */
  147.  
  148.     struct Gadget *ReqGadget;        /* pointer to a list of Gadgets */
  149.     struct Border *ReqBorder;        /* the box's border */
  150.     struct IntuiText *ReqText;        /* the box's text */
  151.     USHORT Flags;            /* see definitions below */
  152.  
  153.     /* pen number for back-plane fill before draws */
  154.     UBYTE BackFill;
  155.     /* Layer in place of clip rect    */
  156.     struct Layer *ReqLayer;
  157.  
  158.     UBYTE ReqPad1[32];
  159.  
  160.     /* If the BitMap plane pointers are non-zero, this tells the system 
  161.      * that the image comes pre-drawn (if the appliprog wants to define 
  162.      * it's own box, in any shape or size it wants!);  this is OK by 
  163.      * Intuition as long as there's a good correspondence between 
  164.      * the image and the specified Gadgets
  165.      */
  166.     struct BitMap *ImageBMap;    /* points to the BitMap of PREDRAWN imagery */
  167.     struct Window *RWindow;    /* added.  points back to Window */
  168.     UBYTE ReqPad2[36];
  169. };
  170.  
  171.  
  172. /* FLAGS SET BY THE APPLIPROG */
  173. #define POINTREL 0x0001     /* if POINTREL set, TopLeft is relative to pointer*/
  174. #define PREDRAWN 0x0002     /* if ReqBMap points to predrawn Requester imagery */
  175. #define NOISYREQ 0x0004     /* if you don't want requester to filter input       */
  176. /* FLAGS SET BY BOTH THE APPLIPROG AND INTUITION */
  177.  
  178. /* FLAGS SET BY INTUITION */
  179. #define REQOFFWINDOW    0x1000    /* part of one of the Gadgets was offwindow */
  180. #define REQACTIVE    0x2000    /* this requester is active */
  181. #define SYSREQUEST    0x4000    /* this requester caused by system */
  182. #define DEFERREFRESH    0x8000    /* this Requester stops a Refresh broadcast */
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189. /* ======================================================================== */
  190. /* === Gadget ============================================================= */
  191. /* ======================================================================== */
  192. struct Gadget
  193. {
  194.     struct Gadget *NextGadget;    /* next gadget in the list */
  195.  
  196.     SHORT LeftEdge, TopEdge;    /* "hit box" of gadget */
  197.     SHORT Width, Height;    /* "hit box" of gadget */
  198.  
  199.     USHORT Flags;        /* see below for list of defines */
  200.  
  201.     USHORT Activation;        /* see below for list of defines */
  202.  
  203.     USHORT GadgetType;        /* see below for defines */
  204.  
  205.     /* appliprog can specify that the Gadget be rendered as either as Border
  206.      * or an Image.  This variable points to which (or equals NULL if there's
  207.      * nothing to be rendered about this Gadget)
  208.      */
  209.     APTR GadgetRender;
  210.  
  211.     /* appliprog can specify "highlighted" imagery rather than algorithmic
  212.      * this can point to either Border or Image data
  213.      */
  214.     APTR SelectRender;
  215.  
  216.     struct IntuiText *GadgetText;   /* text for this gadget */
  217.  
  218.     /* by using the MutualExclude word, the appliprog can describe 
  219.      * which gadgets mutually-exclude which other ones.     The bits 
  220.      * in MutualExclude correspond to the gadgets in object containing 
  221.      * the gadget list.     If this gadget is selected and a bit is set 
  222.      * in this gadget's MutualExclude and the gadget corresponding to 
  223.      * that bit is currently selected (e.g. bit 2 set and gadget 2 
  224.      * is currently selected) that gadget must be unselected.  
  225.      * Intuition does the visual unselecting (with checkmarks) and 
  226.      * leaves it up to the program to unselect internally
  227.      */
  228.     LONG MutualExclude;     /* set bits mean this gadget excludes that gadget */
  229.  
  230.     /* pointer to a structure of special data required by Proportional, 
  231.      * String and Integer Gadgets 
  232.      */
  233.     APTR SpecialInfo;
  234.  
  235.     USHORT GadgetID;    /* user-definable ID field */
  236.     APTR UserData;    /* ptr to general purpose User data (ignored by In) */
  237. };
  238.  
  239.  
  240. /* --- FLAGS SET BY THE APPLIPROG ----------------------------------------- */
  241. /* combinations in these bits describe the highlight technique to be used */
  242. #define GADGHIGHBITS    0x0003
  243. #define GADGHCOMP    0x0000    /* Complement the select box */
  244. #define GADGHBOX    0x0001    /* Draw a box around the image */
  245. #define GADGHIMAGE    0x0002    /* Blast in this alternate image */
  246. #define GADGHNONE    0x0003    /* don't highlight */
  247.  
  248. /* set this flag if the GadgetRender and SelectRender point to Image imagery, 
  249.  * clear if it's a Border 
  250.  */
  251. #define GADGIMAGE 0x0004 
  252.  
  253. /* combinations in these next two bits specify to which corner the gadget's
  254.  *  Left & Top coordinates are relative.  If relative to Top/Left,
  255.  *  these are "normal" coordinates (everything is relative to something in
  256.  *  this universe)
  257.  */
  258. #define GRELBOTTOM    0x0008    /* set if rel to bottom, clear if rel top */
  259. #define GRELRIGHT    0x0010    /* set if rel to right, clear if to left */
  260. /* set the RELWIDTH bit to spec that Width is relative to width of screen */
  261. #define GRELWIDTH    0x0020
  262. /* set the RELHEIGHT bit to spec that Height is rel to height of screen */
  263. #define GRELHEIGHT    0x0040
  264.  
  265. /* the SELECTED flag is initialized by you and set by Intuition.  It 
  266.  * specifies whether or not this Gadget is currently selected/highlighted
  267.  */
  268. #define SELECTED    0x0080
  269.  
  270.  
  271. /* the GADGDISABLED flag is initialized by you and later set by Intuition
  272.  * according to your calls to On/OffGadget().  It specifies whether or not 
  273.  * this Gadget is currently disabled from being selected
  274.  */
  275. #define GADGDISABLED    0x0100
  276.  
  277.  
  278. /* --- These are the Activation flag bits --------------------------------- */
  279. /* RELVERIFY is set if you want to verify that the pointer was still over
  280.  *  the gadget when the select button was released
  281.  */
  282. #define RELVERIFY    0x0001
  283.  
  284. /* the flag GADGIMMEDIATE, when set, informs the caller that the gadget
  285.  *  was activated when it was activated.  this flag works in conjunction with
  286.  *  the RELVERIFY flag
  287.  */
  288. #define GADGIMMEDIATE    0x0002
  289.  
  290. /* the flag ENDGADGET, when set, tells the system that this gadget, when
  291.  * selected, causes the Requester or AbsMessage to be ended.  Requesters or
  292.  *  AbsMessages that are ended are erased and unlinked from the system */
  293. #define ENDGADGET    0x0004
  294.  
  295. /* the FOLLOWMOUSE flag, when set, specifies that you want to receive
  296.  * reports on mouse movements (ie, you want the REPORTMOUSE function for
  297.  * your Window).  When the Gadget is deselected (immediately if you have
  298.  * no RELVERIFY) the previous state of the REPORTMOUSE flag is restored
  299.  * You probably want to set the GADGIMMEDIATE flag when using FOLLOWMOUSE,
  300.  * since that's the only reasonable way you have of learning why Intuition
  301.  * is suddenly sending you a stream of mouse movement events.  If you don't
  302.  * set RELVERIFY, you'll get at least one Mouse Position event.
  303.  */
  304. #define FOLLOWMOUSE    0x0008
  305.  
  306. /* if any of the BORDER flags are set in a Gadget that's included in the
  307.  * Gadget list when a Window is opened, the corresponding Border will
  308.  * be adjusted to make room for the Gadget
  309.  */
  310. #define RIGHTBORDER    0x0010
  311. #define LEFTBORDER    0x0020
  312. #define TOPBORDER    0x0040
  313. #define BOTTOMBORDER    0x0080
  314.  
  315. #define TOGGLESELECT    0x0100    /* this bit for toggle-select mode */
  316.  
  317. #define STRINGCENTER    0x0200    /* should be a StringInfo flag, but it's OK */
  318. #define STRINGRIGHT    0x0400    /* should be a StringInfo flag, but it's OK */
  319.  
  320. #define LONGINT        0x0800    /* this String Gadget is actually LONG Int */
  321.  
  322. #define ALTKEYMAP    0x1000    /* this String has an alternate keymap */
  323.  
  324. #define BOOLEXTEND    0x2000    /* this Boolean Gadget has a BoolInfo    */
  325.  
  326.  
  327. /* --- GADGET TYPES ------------------------------------------------------- */
  328. /* These are the Gadget Type definitions for the variable GadgetType
  329.  * gadget number type MUST start from one.  NO TYPES OF ZERO ALLOWED.
  330.  * first comes the mask for Gadget flags reserved for Gadget typing
  331.  */
  332. #define GADGETTYPE    0xFC00    /* all Gadget Global Type flags (padded) */
  333. #define SYSGADGET    0x8000    /* 1 = SysGadget, 0 = AppliGadget */
  334. #define SCRGADGET    0x4000    /* 1 = ScreenGadget, 0 = WindowGadget */
  335. #define GZZGADGET    0x2000    /* 1 = Gadget for GIMMEZEROZERO borders */
  336. #define REQGADGET    0x1000    /* 1 = this is a Requester Gadget */
  337. /* system gadgets */
  338. #define SIZING        0x0010
  339. #define WDRAGGING    0x0020
  340. #define SDRAGGING    0x0030
  341. #define WUPFRONT    0x0040
  342. #define SUPFRONT    0x0050
  343. #define WDOWNBACK    0x0060
  344. #define SDOWNBACK    0x0070
  345. #define CLOSE        0x0080
  346. /* application gadgets */
  347. #define BOOLGADGET    0x0001
  348. #define GADGET0002    0x0002
  349. #define PROPGADGET    0x0003
  350. #define STRGADGET    0x0004
  351.  
  352.  
  353. /* ======================================================================== */
  354. /* === BoolInfo======================================================= */
  355. /* ======================================================================== */
  356. /* This is the special data needed by an Extended Boolean Gadget
  357.  * Typically this structure will be pointed to by the Gadget field SpecialInfo
  358.  */
  359. struct BoolInfo
  360. {
  361.     USHORT Flags;    /* defined below */
  362.     UWORD  *Mask;    /* bit mask for highlighting and selecting
  363.              * mask must follow the same rules as an Image
  364.              * plane.  It's width and height are determined
  365.              * by the width and height of the gadget's 
  366.              * select box. (i.e. Gadget.Width and .Height).
  367.              */
  368.     ULONG  Reserved;    /* set to 0    */
  369. };
  370.  
  371. /* set BoolInfo.Flags to this flag bit.
  372.  * in the future, additional bits might mean more stuff hanging
  373.  * off of BoolInfo.Reserved.
  374.  */
  375. #define BOOLMASK    0x0001    /* extension is for masked gadget */
  376.  
  377. /* ======================================================================== */
  378. /* === PropInfo =========================================================== */
  379. /* ======================================================================== */
  380. /* this is the special data required by the proportional Gadget
  381.  * typically, this data will be pointed to by the Gadget variable SpecialInfo
  382.  */
  383. struct PropInfo
  384. {
  385.     USHORT Flags;    /* general purpose flag bits (see defines below) */
  386.  
  387.     /* You initialize the Pot variables before the Gadget is added to 
  388.      * the system.  Then you can look here for the current settings 
  389.      * any time, even while User is playing with this Gadget.  To 
  390.      * adjust these after the Gadget is added to the System, use 
  391.      * ModifyProp();  The Pots are the actual proportional settings, 
  392.      * where a value of zero means zero and a value of MAXPOT means 
  393.      * that the Gadget is set to its maximum setting.  
  394.      */
  395.     USHORT HorizPot;    /* 16-bit FixedPoint horizontal quantity percentage */
  396.     USHORT VertPot;    /* 16-bit FixedPoint vertical quantity percentage */
  397.  
  398.     /* the 16-bit FixedPoint Body variables describe what percentage of 
  399.      * the entire body of stuff referred to by this Gadget is actually 
  400.      * shown at one time.  This is used with the AUTOKNOB routines, 
  401.      * to adjust the size of the AUTOKNOB according to how much of 
  402.      * the data can be seen.  This is also used to decide how far 
  403.      * to advance the Pots when User hits the Container of the Gadget.    
  404.      * For instance, if you were controlling the display of a 5-line 
  405.      * Window of text with this Gadget, and there was a total of 15 
  406.      * lines that could be displayed, you would set the VertBody value to 
  407.      *       (MAXBODY / (TotalLines / DisplayLines)) = MAXBODY / 3.
  408.      * Therefore, the AUTOKNOB would fill 1/3 of the container, and 
  409.      * if User hits the Cotainer outside of the knob, the pot would 
  410.      * advance 1/3 (plus or minus) If there's no body to show, or 
  411.      * the total amount of displayable info is less than the display area, 
  412.      * set the Body variables to the MAX.  To adjust these after the 
  413.      * Gadget is added to the System, use ModifyProp();     
  414.      */
  415.     USHORT HorizBody;        /* horizontal Body */ 
  416.     USHORT VertBody;        /* vertical Body */
  417.  
  418.     /* these are the variables that Intuition sets and maintains */
  419.     USHORT CWidth;    /* Container width (with any relativity absoluted) */
  420.     USHORT CHeight;    /* Container height (with any relativity absoluted) */
  421.     USHORT HPotRes, VPotRes; /* pot increments */
  422.     USHORT LeftBorder;        /* Container borders */
  423.     USHORT TopBorder;        /* Container borders */
  424. };
  425.  
  426.  
  427. /* --- FLAG BITS ---------------------------------------------------------- */
  428. #define AUTOKNOB    0x0001    /* this flag sez:  gimme that old auto-knob */
  429. #define FREEHORIZ    0x0002    /* if set, the knob can move horizontally */
  430. #define FREEVERT    0x0004    /* if set, the knob can move vertically */
  431. #define PROPBORDERLESS    0x0008    /* if set, no border will be rendered */
  432. #define KNOBHIT        0x0100    /* set when this Knob is hit */
  433.  
  434. #define KNOBHMIN    6    /* minimum horizontal size of the Knob */
  435. #define KNOBVMIN    4    /* minimum vertical size of the Knob */
  436. #define MAXBODY        0xFFFF    /* maximum body value */
  437. #define MAXPOT        0xFFFF    /* maximum pot value */
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444. /* ======================================================================== */
  445. /* === StringInfo ========================================================= */
  446. /* ======================================================================== */
  447. /* this is the special data required by the string Gadget
  448.  * typically, this data will be pointed to by the Gadget variable SpecialInfo
  449.  */
  450. struct StringInfo
  451. {
  452.     /* you initialize these variables, and then Intuition maintains them */
  453.     UBYTE *Buffer;    /* the buffer containing the start and final string */
  454.     UBYTE *UndoBuffer;    /* optional buffer for undoing current entry */
  455.     SHORT BufferPos;    /* character position in Buffer */
  456.     SHORT MaxChars;    /* max number of chars in Buffer (including NULL) */
  457.     SHORT DispPos;    /* Buffer position of first displayed character */
  458.  
  459.     /* Intuition initializes and maintains these variables for you */
  460.     SHORT UndoPos;    /* character position in the undo buffer */
  461.     SHORT NumChars;    /* number of characters currently in Buffer */
  462.     SHORT DispCount;    /* number of whole characters visible in Container */
  463.     SHORT CLeft, CTop;    /* topleft offset of the container */
  464.     struct Layer *LayerPtr;    /* the RastPort containing this Gadget */
  465.  
  466.     /* you can initialize this variable before the gadget is submitted to
  467.      * Intuition, and then examine it later to discover what integer 
  468.      * the user has entered (if the user never plays with the gadget, 
  469.      * the value will be unchanged from your initial setting)
  470.      */
  471.     LONG LongInt;
  472.  
  473.     /* If you want this Gadget to use your own Console keymapping, you
  474.      * set the ALTKEYMAP bit in the Activation flags of the Gadget, and then
  475.      * set this variable to point to your keymap.  If you don't set the
  476.      * ALTKEYMAP, you'll get the standard ASCII keymapping.
  477.      */
  478.     struct KeyMap *AltKeyMap;
  479. };
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486. /* ======================================================================== */
  487. /* === IntuiText ========================================================== */
  488. /* ======================================================================== */
  489. /* IntuiText is a series of strings that start with a screen location
  490.  *  (always relative to the upper-left corner of something) and then the
  491.  *  text of the string.     The text is null-terminated.
  492.  */
  493. struct IntuiText
  494. {
  495.     UBYTE FrontPen, BackPen;    /* the pen numbers for the rendering */
  496.     UBYTE DrawMode;        /* the mode for rendering the text */
  497.     SHORT LeftEdge;        /* relative start location for the text */
  498.     SHORT TopEdge;        /* relative start location for the text */
  499.     struct TextAttr *ITextFont; /* if NULL, you accept the default */
  500.     UBYTE *IText;        /* pointer to null-terminated text */
  501.     struct IntuiText *NextText; /* continuation to TxWrite another text */
  502. };
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509. /* ======================================================================== */
  510. /* === Border ============================================================= */
  511. /* ======================================================================== */
  512. /* Data type Border, used for drawing a series of lines which is intended for
  513.  *  use as a border drawing, but which may, in fact, be used to render any
  514.  *  arbitrary vector shape.
  515.  *  The routine DrawBorder sets up the RastPort with the appropriate
  516.  *  variables, then does a Move to the first coordinate, then does Draws
  517.  *  to the subsequent coordinates.
  518.  *  After all the Draws are done, if NextBorder is non-zero we call DrawBorder
  519.  *  recursively
  520.  */
  521. struct Border
  522. {
  523.     SHORT LeftEdge, TopEdge;    /* initial offsets from the origin */
  524.     UBYTE FrontPen, BackPen;    /* pens numbers for rendering */
  525.     UBYTE DrawMode;        /* mode for rendering */
  526.     BYTE Count;            /* number of XY pairs */
  527.     SHORT *XY;            /* vector coordinate pairs rel to LeftTop*/
  528.     struct Border *NextBorder;    /* pointer to any other Border too */
  529. };
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536. /* ======================================================================== */
  537. /* === Image ============================================================== */
  538. /* ======================================================================== */
  539. /* This is a brief image structure for very simple transfers of 
  540.  * image data to a RastPort
  541.  */
  542. struct Image
  543. {
  544.     SHORT LeftEdge;        /* starting offset relative to some origin */
  545.     SHORT TopEdge;        /* starting offsets relative to some origin */
  546.     SHORT Width;        /* pixel size (though data is word-aligned) */
  547.     SHORT Height, Depth;    /* pixel sizes */
  548.     USHORT *ImageData;        /* pointer to the actual word-aligned bits */
  549.  
  550.     /* the PlanePick and PlaneOnOff variables work much the same way as the
  551.      * equivalent GELS Bob variables.  It's a space-saving 
  552.      * mechanism for image data.  Rather than defining the image data
  553.      * for every plane of the RastPort, you need define data only 
  554.      * for the planes that are not entirely zero or one.  As you 
  555.      * define your Imagery, you will often find that most of the planes 
  556.      * ARE just as color selectors.  For instance, if you're designing 
  557.      * a two-color Gadget to use colors two and three, and the Gadget 
  558.      * will reside in a five-plane display, bit plane zero of your 
  559.      * imagery would be all ones, bit plane one would have data that 
  560.      * describes the imagery, and bit planes two through four would be 
  561.      * all zeroes.  Using these flags allows you to avoid wasting all 
  562.      * that memory in this way:     first, you specify which planes you 
  563.      * want your data to appear in using the PlanePick variable.  For 
  564.      * each bit set in the variable, the next "plane" of your image 
  565.      * data is blitted to the display.    For each bit clear in this 
  566.      * variable, the corresponding bit in PlaneOnOff is examined.  
  567.      * If that bit is clear, a "plane" of zeroes will be used.    
  568.      * If the bit is set, ones will go out instead.  So, for our example:
  569.      *     Gadget.PlanePick = 0x02;
  570.      *     Gadget.PlaneOnOff = 0x01;
  571.      * Note that this also allows for generic Gadgets, like the 
  572.      * System Gadgets, which will work in any number of bit planes.  
  573.      * Note also that if you want an Image that is only a filled 
  574.      * rectangle, you can get this by setting PlanePick to zero 
  575.      * (pick no planes of data) and set PlaneOnOff to describe the pen 
  576.      * color of the rectangle.    
  577.      */
  578.     UBYTE PlanePick, PlaneOnOff;
  579.  
  580.     /* if the NextImage variable is not NULL, Intuition presumes that 
  581.      * it points to another Image structure with another Image to be 
  582.      * rendered
  583.      */
  584.     struct Image *NextImage;
  585. };
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592. /* ======================================================================== */
  593. /* === IntuiMessage ======================================================= */
  594. /* ======================================================================== */
  595. struct IntuiMessage
  596. {
  597.     struct Message ExecMessage;
  598.  
  599.     /* the Class bits correspond directly with the IDCMP Flags, except for the
  600.      * special bit LONELYMESSAGE (defined below)
  601.      */
  602.     ULONG Class;
  603.  
  604.     /* the Code field is for special values like MENU number */
  605.     USHORT Code;
  606.  
  607.     /* the Qualifier field is a copy of the current InputEvent's Qualifier */
  608.     USHORT Qualifier;
  609.  
  610.     /* IAddress contains particular addresses for Intuition functions, like
  611.      * the pointer to the Gadget or the Screen
  612.      */
  613.     APTR IAddress;
  614.  
  615.     /* when getting mouse movement reports, any event you get will have the
  616.      * the mouse coordinates in these variables.  the coordinates are relative
  617.      * to the upper-left corner of your Window (GIMMEZEROZERO notwithstanding)
  618.      */
  619.     SHORT MouseX, MouseY; 
  620.  
  621.     /* the time values are copies of the current system clock time.  Micros
  622.      * are in units of microseconds, Seconds in seconds.
  623.      */
  624.     ULONG Seconds, Micros;
  625.  
  626.     /* the IDCMPWindow variable will always have the address of the Window of 
  627.      * this IDCMP 
  628.      */
  629.     struct Window *IDCMPWindow;
  630.  
  631.     /* system-use variable */
  632.     struct IntuiMessage *SpecialLink;
  633. };
  634.  
  635.  
  636. /* --- IDCMP Classes ------------------------------------------------------ */
  637. #define SIZEVERIFY        0x00000001  /*    See the Programmer's Guide  */
  638. #define NEWSIZE            0x00000002  /*    See the Programmer's Guide  */
  639. #define REFRESHWINDOW        0x00000004  /*    See the Programmer's Guide  */
  640. #define MOUSEBUTTONS        0x00000008  /*    See the Programmer's Guide  */
  641. #define MOUSEMOVE        0x00000010  /*    See the Programmer's Guide  */
  642. #define GADGETDOWN        0x00000020  /*    See the Programmer's Guide  */
  643. #define GADGETUP        0x00000040  /*    See the Programmer's Guide  */
  644. #define REQSET            0x00000080  /*    See the Programmer's Guide  */
  645. #define MENUPICK        0x00000100  /*    See the Programmer's Guide  */
  646. #define CLOSEWINDOW        0x00000200  /*    See the Programmer's Guide  */
  647. #define RAWKEY            0x00000400  /*    See the Programmer's Guide  */
  648. #define REQVERIFY        0x00000800  /*    See the Programmer's Guide  */
  649. #define REQCLEAR        0x00001000  /*    See the Programmer's Guide  */
  650. #define MENUVERIFY        0x00002000  /*    See the Programmer's Guide  */
  651. #define NEWPREFS        0x00004000  /*    See the Programmer's Guide  */
  652. #define DISKINSERTED        0x00008000  /*    See the Programmer's Guide  */
  653. #define DISKREMOVED        0x00010000  /*    See the Programmer's Guide  */
  654. #define WBENCHMESSAGE        0x00020000  /*    See the Programmer's Guide  */
  655. #define ACTIVEWINDOW        0x00040000  /*    See the Programmer's Guide  */
  656. #define INACTIVEWINDOW        0x00080000  /*    See the Programmer's Guide  */
  657. #define DELTAMOVE        0x00100000  /*    See the Programmer's Guide  */
  658. #define VANILLAKEY        0x00200000  /*    See the Programmer's Guide  */
  659. #define INTUITICKS        0x00400000  /*    See the Programmer's Guide  */
  660. /* NOTEZ-BIEN:            0x80000000 is reserved for internal use      */
  661.  
  662. /* the IDCMP Flags do not use this special bit, which is cleared when
  663.  * Intuition sends its special message to the Task, and set when Intuition
  664.  * gets its Message back from the Task.     Therefore, I can check here to
  665.  * find out fast whether or not this Message is available for me to send
  666.  */
  667. #define LONELYMESSAGE    0x80000000
  668.  
  669.  
  670. /* --- IDCMP Codes -------------------------------------------------------- */
  671. /* This group of codes is for the MENUVERIFY function */
  672. #define MENUHOT        0x0001    /* IntuiWants verification or MENUCANCEL    */
  673. #define MENUCANCEL    0x0002    /* HOT Reply of this cancels Menu operation */
  674. #define MENUWAITING    0x0003    /* Intuition simply wants a ReplyMsg() ASAP */
  675.  
  676. /* These are internal tokens to represent state of verification attempts
  677.  * shown here as a clue.
  678.  */
  679. #define OKOK        MENUHOT /* guy didn't care            */
  680. #define OKABORT        0x0004    /* window rendered question moot    */
  681. #define OKCANCEL    MENUCANCEL /* window sent cancel reply        */
  682.  
  683. /* This group of codes is for the WBENCHMESSAGE messages */
  684. #define WBENCHOPEN    0x0001
  685. #define WBENCHCLOSE    0x0002
  686.  
  687.  
  688.  
  689. /* ======================================================================== */
  690. /* === Window ============================================================= */
  691. /* ======================================================================== */
  692. struct Window
  693. {
  694.     struct Window *NextWindow;        /* for the linked list in a screen */
  695.  
  696.     SHORT LeftEdge, TopEdge;        /* screen dimensions of window */
  697.     SHORT Width, Height;        /* screen dimensions of window */
  698.  
  699.     SHORT MouseY, MouseX;        /* relative to upper-left of window */
  700.  
  701.     SHORT MinWidth, MinHeight;        /* minimum sizes */
  702.     USHORT MaxWidth, MaxHeight;        /* maximum sizes */
  703.  
  704.     ULONG Flags;            /* see below for defines */
  705.  
  706.     struct Menu *MenuStrip;        /* the strip of Menu headers */
  707.  
  708.     UBYTE *Title;            /* the title text for this window */
  709.  
  710.     struct Requester *FirstRequest;    /* all active Requesters */
  711.  
  712.     struct Requester *DMRequest;    /* double-click Requester */
  713.  
  714.     SHORT ReqCount;            /* count of reqs blocking Window */
  715.  
  716.     struct Screen *WScreen;        /* this Window's Screen */
  717.     struct RastPort *RPort;        /* this Window's very own RastPort */
  718.  
  719.     /* the border variables describe the window border.     If you specify
  720.      * GIMMEZEROZERO when you open the window, then the upper-left of the
  721.      * ClipRect for this window will be upper-left of the BitMap (with correct
  722.      * offsets when in SuperBitMap mode; you MUST select GIMMEZEROZERO when
  723.      * using SuperBitMap).  If you don't specify ZeroZero, then you save
  724.      * memory (no allocation of RastPort, Layer, ClipRect and associated
  725.      * Bitmaps), but you also must offset all your writes by BorderTop,
  726.      * BorderLeft and do your own mini-clipping to prevent writing over the
  727.      * system gadgets
  728.      */
  729.     BYTE BorderLeft, BorderTop, BorderRight, BorderBottom;
  730.     struct RastPort *BorderRPort;
  731.  
  732.  
  733.     /* You supply a linked-list of Gadgets for your Window.
  734.      * This list DOES NOT include system gadgets.  You get the standard
  735.      * window system gadgets by setting flag-bits in the variable Flags (see
  736.      * the bit definitions below)
  737.      */
  738.     struct Gadget *FirstGadget;
  739.  
  740.     /* these are for opening/closing the windows */
  741.     struct Window *Parent, *Descendant;
  742.  
  743.     /* sprite data information for your own Pointer
  744.      * set these AFTER you Open the Window by calling SetPointer()
  745.      */
  746.     USHORT *Pointer;    /* sprite data */
  747.     BYTE PtrHeight;    /* sprite height (not including sprite padding) */
  748.     BYTE PtrWidth;    /* sprite width (must be less than or equal to 16) */
  749.     BYTE XOffset, YOffset;    /* sprite offsets */
  750.  
  751.     /* the IDCMP Flags and User's and Intuition's Message Ports */
  752.     ULONG IDCMPFlags;    /* User-selected flags */
  753.     struct MsgPort *UserPort, *WindowPort;
  754.     struct IntuiMessage *MessageKey;
  755.  
  756.     UBYTE DetailPen, BlockPen;    /* for bar/border/gadget rendering */
  757.  
  758.     /* the CheckMark is a pointer to the imagery that will be used when 
  759.      * rendering MenuItems of this Window that want to be checkmarked
  760.      * if this is equal to NULL, you'll get the default imagery
  761.      */
  762.     struct Image *CheckMark;
  763.  
  764.     UBYTE *ScreenTitle; /* if non-null, Screen title when Window is active */
  765.  
  766.     /* These variables have the mouse coordinates relative to the 
  767.      * inner-Window of GIMMEZEROZERO Windows.  This is compared with the
  768.      * MouseX and MouseY variables, which contain the mouse coordinates
  769.      * relative to the upper-left corner of the Window, GIMMEZEROZERO
  770.      * notwithstanding
  771.      */
  772.     SHORT GZZMouseX;
  773.     SHORT GZZMouseY;
  774.     /* these variables contain the width and height of the inner-Window of
  775.      * GIMMEZEROZERO Windows
  776.      */
  777.     SHORT GZZWidth;
  778.     SHORT GZZHeight;
  779.  
  780.     UBYTE *ExtData;
  781.  
  782.     BYTE *UserData;    /* general-purpose pointer to User data extension */
  783.  
  784.     /** jimm: NEW: 11/18/85: this pointer keeps a duplicate of what 
  785.      * Window.RPort->Layer is _supposed_ to be pointing at
  786.      */
  787.     struct Layer *WLayer;
  788.  
  789.     /* jimm: NEW 1.2: need to keep track of the font that
  790.      * OpenWindow opened, in case user SetFont's into RastPort
  791.      */
  792.     struct TextFont *IFont;
  793. };
  794.  
  795.  
  796. /* --- FLAGS REQUESTED (NOT DIRECTLY SET THOUGH) BY THE APPLIPROG --------- */
  797. #define WINDOWSIZING    0x0001      /* include sizing system-gadget? */
  798. #define WINDOWDRAG    0x0002      /* include dragging system-gadget? */
  799. #define WINDOWDEPTH    0x0004      /* include depth arrangement gadget? */
  800. #define WINDOWCLOSE    0x0008      /* include close-box system-gadget? */
  801.  
  802. #define SIZEBRIGHT    0x0010    /* size gadget uses right border */
  803. #define SIZEBBOTTOM    0x0020    /* size gadget uses bottom border */
  804.  
  805. /* --- refresh modes ------------------------------------------------------ */
  806. /* combinations of the REFRESHBITS select the refresh type */
  807. #define REFRESHBITS    0x00C0
  808. #define SMART_REFRESH    0x0000
  809. #define SIMPLE_REFRESH    0x0040
  810. #define SUPER_BITMAP    0x0080
  811. #define OTHER_REFRESH    0x00C0
  812.  
  813. #define BACKDROP    0x0100    /* this is an ever-popular BACKDROP window */
  814.  
  815. #define REPORTMOUSE    0x0200    /* set this to hear about every mouse move */
  816.  
  817. #define GIMMEZEROZERO    0x0400    /* make extra border stuff */
  818.  
  819. #define BORDERLESS    0x0800    /* set this to get a Window sans border */
  820.  
  821. #define ACTIVATE    0x1000    /* when Window opens, it's the Active one */
  822.  
  823. /* FLAGS SET BY INTUITION */
  824. #define WINDOWACTIVE  0x2000    /* this window is the active one */
  825. #define INREQUEST     0x4000    /* this window is in request mode */
  826. #define MENUSTATE     0x8000    /* this Window is active with its Menus on */
  827.  
  828. /* --- Other User Flags --------------------------------------------------- */
  829. #define RMBTRAP        0x00010000    /* Catch RMB events for your own */
  830. #define NOCAREREFRESH    0x00020000    /* not to be bothered with REFRESH */
  831.  
  832.  
  833. /* --- Other Intuition Flags ---------------------------------------------- */
  834. #define WINDOWREFRESH    0x01000000    /* Window is currently refreshing */
  835. #define WBENCHWINDOW    0x02000000    /* WorkBench tool ONLY Window */
  836. #define WINDOWTICKED    0x04000000    /* only one timer tick at a time */
  837.  
  838. #define SUPER_UNUSED    0xFCFC0000    /* bits of Flag unused yet */
  839.  
  840.  
  841. /* --- see struct IntuiMessage for the IDCMP Flag definitions ------------- */
  842.  
  843.  
  844.  
  845.  
  846. /* ======================================================================== */
  847. /* === NewWindow ========================================================== */
  848. /* ======================================================================== */
  849. struct NewWindow
  850. {
  851.     SHORT LeftEdge, TopEdge;        /* screen dimensions of window */
  852.     SHORT Width, Height;        /* screen dimensions of window */
  853.  
  854.     UBYTE DetailPen, BlockPen;        /* for bar/border/gadget rendering */
  855.  
  856.     ULONG IDCMPFlags;            /* User-selected IDCMP flags */
  857.  
  858.     ULONG Flags;            /* see Window struct for defines */
  859.  
  860.     /* You supply a linked-list of Gadgets for your Window.
  861.      *    This list DOES NOT include system Gadgets.  You get the standard
  862.      *    system Window Gadgets by setting flag-bits in the variable Flags (see
  863.      *    the bit definitions under the Window structure definition)
  864.      */
  865.     struct Gadget *FirstGadget;
  866.  
  867.     /* the CheckMark is a pointer to the imagery that will be used when 
  868.      * rendering MenuItems of this Window that want to be checkmarked
  869.      * if this is equal to NULL, you'll get the default imagery
  870.      */
  871.     struct Image *CheckMark;
  872.  
  873.     UBYTE *Title;              /* the title text for this window */
  874.     
  875.     /* the Screen pointer is used only if you've defined a CUSTOMSCREEN and
  876.      * want this Window to open in it.    If so, you pass the address of the
  877.      * Custom Screen structure in this variable.  Otherwise, this variable
  878.      * is ignored and doesn't have to be initialized.
  879.      */
  880.     struct Screen *Screen;
  881.     
  882.     /* SUPER_BITMAP Window?  If so, put the address of your BitMap structure
  883.      * in this variable.  If not, this variable is ignored and doesn't have 
  884.      * to be initialized
  885.      */
  886.     struct BitMap *BitMap;
  887.  
  888.     /* the values describe the minimum and maximum sizes of your Windows.
  889.      * these matter only if you've chosen the WINDOWSIZING Gadget option,
  890.      * which means that you want to let the User to change the size of 
  891.      * this Window.  You describe the minimum and maximum sizes that the
  892.      * Window can grow by setting these variables.  You can initialize
  893.      * any one these to zero, which will mean that you want to duplicate
  894.      * the setting for that dimension (if MinWidth == 0, MinWidth will be
  895.      * set to the opening Width of the Window).
  896.      * You can change these settings later using SetWindowLimits().
  897.      * If you haven't asked for a SIZING Gadget, you don't have to
  898.      * initialize any of these variables.
  899.      */
  900.     SHORT MinWidth, MinHeight;         /* minimums */
  901.     USHORT MaxWidth, MaxHeight;          /* maximums */
  902.  
  903.     /* the type variable describes the Screen in which you want this Window to
  904.      * open.  The type value can either be CUSTOMSCREEN or one of the
  905.      * system standard Screen Types such as WBENCHSCREEN.  See the
  906.      * type definitions under the Screen structure
  907.      */
  908.     USHORT Type;
  909. };
  910.  
  911.  
  912. #ifndef INTUITION_SCREENS_H
  913. #include "intuition/screens.h"
  914. #endif
  915.  
  916. #ifndef INTUITION_PREFERENCES_H
  917. #include "intuition/preferences.h"
  918. #endif
  919.  
  920. /* ======================================================================== */
  921. /* === Remember =========================================================== */
  922. /* ======================================================================== */
  923. /* this structure is used for remembering what memory has been allocated to
  924.  * date by a given routine, so that a premature abort or systematic exit
  925.  * can deallocate memory cleanly, easily, and completely
  926.  */
  927. struct Remember
  928. {
  929.     struct Remember *NextRemember;
  930.     ULONG RememberSize;
  931.     UBYTE *Memory;
  932. };
  933.  
  934.  
  935.  
  936.  
  937.  
  938. /* ======================================================================== */
  939. /* === Miscellaneous ====================================================== */
  940. /* ======================================================================== */
  941.  
  942. /* = MACROS ============================================================== */
  943. #define MENUNUM(n) (n & 0x1F)
  944. #define ITEMNUM(n) ((n >> 5) & 0x003F)
  945. #define SUBNUM(n) ((n >> 11) & 0x001F)
  946.  
  947. #define SHIFTMENU(n) (n & 0x1F)
  948. #define SHIFTITEM(n) ((n & 0x3F) << 5)
  949. #define SHIFTSUB(n) ((n & 0x1F) << 11)
  950.  
  951.  
  952. #define SRBNUM(n)    (0x08 - (n >> 4))    /* SerRWBits -> read bits per char */
  953. #define SWBNUM(n)    (0x08 - (n & 0x0F))/* SerRWBits -> write bits per chr */
  954. #define SSBNUM(n)    (0x01 + (n >> 4))    /* SerStopBuf -> stop bits per chr */
  955. #define SPARNUM(n)   (n >> 4)        /* SerParShk -> parity setting      */
  956. #define SHAKNUM(n)   (n & 0x0F)        /* SerParShk -> handshake mode      */
  957.  
  958.  
  959. /* = MENU STUFF =========================================================== */
  960. #define NOMENU 0x001F
  961. #define NOITEM 0x003F
  962. #define NOSUB  0x001F
  963. #define MENUNULL 0xFFFF
  964.  
  965.  
  966. /* = =RJ='s peculiarities ================================================= */
  967. #define FOREVER for(;;)
  968. #define SIGN(x) ( ((x) > 0) - ((x) < 0) )
  969. #define NOT !
  970.  
  971. /* these defines are for the COMMSEQ and CHECKIT menu stuff.  If CHECKIT,
  972.  * I'll use a generic Width (for all resolutions) for the CheckMark.
  973.  * If COMMSEQ, likewise I'll use this generic stuff
  974.  */
  975. #define CHECKWIDTH    19
  976. #define COMMWIDTH    27
  977. #define LOWCHECKWIDTH    13
  978. #define LOWCOMMWIDTH    16
  979.  
  980.  
  981. /* these are the AlertNumber defines.  if you are calling DisplayAlert()
  982.  * the AlertNumber you supply must have the ALERT_TYPE bits set to one
  983.  * of these patterns
  984.  */
  985. #define ALERT_TYPE    0x80000000
  986. #define RECOVERY_ALERT    0x00000000    /* the system can recover from this */
  987. #define DEADEND_ALERT    0x80000000    /* no recovery possible, this is it */
  988.  
  989.  
  990. /* When you're defining IntuiText for the Positive and Negative Gadgets 
  991.  * created by a call to AutoRequest(), these defines will get you 
  992.  * reasonable-looking text.  The only field without a define is the IText
  993.  * field; you decide what text goes with the Gadget
  994.  */
  995. #define AUTOFRONTPEN    0
  996. #define AUTOBACKPEN    1
  997. #define AUTODRAWMODE    JAM2
  998. #define AUTOLEFTEDGE    6
  999. #define AUTOTOPEDGE    3
  1000. #define AUTOITEXTFONT    NULL
  1001. #define AUTONEXTTEXT    NULL
  1002.  
  1003.  
  1004. /* --- RAWMOUSE Codes and Qualifiers (Console OR IDCMP) ------------------- */
  1005. #define SELECTUP    (IECODE_LBUTTON | IECODE_UP_PREFIX)
  1006. #define SELECTDOWN    (IECODE_LBUTTON)
  1007. #define MENUUP        (IECODE_RBUTTON | IECODE_UP_PREFIX)
  1008. #define MENUDOWN    (IECODE_RBUTTON)
  1009. #define ALTLEFT        (IEQUALIFIER_LALT)
  1010. #define ALTRIGHT    (IEQUALIFIER_RALT)
  1011. #define AMIGALEFT    (IEQUALIFIER_LCOMMAND)
  1012. #define AMIGARIGHT    (IEQUALIFIER_RCOMMAND)
  1013. #define AMIGAKEYS    (AMIGALEFT | AMIGARIGHT)
  1014.  
  1015. #define CURSORUP    0x4C
  1016. #define CURSORLEFT    0x4F
  1017. #define CURSORRIGHT    0x4E
  1018. #define CURSORDOWN    0x4D
  1019. #define KEYCODE_Q    0x10
  1020. #define KEYCODE_X    0x32
  1021. #define KEYCODE_N    0x36
  1022. #define KEYCODE_M    0x37
  1023. #define KEYCODE_V    0x34
  1024. #define KEYCODE_B    0x35
  1025.  
  1026. #endif    /* INTUITION_INTUITION_H */
  1027.