home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / ace_basic / ace / include / intuition / sghooks.h < prev   
C/C++ Source or Header  |  1977-12-31  |  8KB  |  212 lines

  1. #ifndef INTUITION_SGHOOKS_H
  2. #define INTUITION_SGHOOKS_H TRUE
  3. /*
  4. ** sghooks.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/01/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for sghooks.h
  17. */
  18. #ifndef SGWorkPtr
  19. #define SGWorkPtr ADDRESS
  20. #endif
  21. #ifndef StringExtendPtr
  22. #define StringExtendPtr ADDRESS
  23. #endif
  24. /*
  25. ** End of StructPointer defines for sghooks.h
  26. */
  27.  
  28.  
  29. #ifndef EXEC_TYPES_H
  30. #include <exec/types.h>
  31. #endif
  32.  
  33. #ifndef GadgetInfoPtr
  34. #define GadgetInfoPtr ADDRESS
  35. #endif
  36.  
  37. STRUCT StringExtend  
  38.     /* display specifications   */
  39.  
  40.     TextFontPtr  _Font   /* must be an open Font (not TextAttr)  */
  41.     STRING Pens SIZE 2      /* color of text/backgroun      */
  42.     STRING ActivePens SIZE 2    /* colors when gadget is active     */
  43.  
  44.     /* edit specifications  */
  45.     LONGINT   InitialModes    /* initial mode flags,  below        */
  46.     HookPtr  EditHook   /* if non-NULL,  must supply WorkBuffer  */
  47.     ADDRESS   WorkBuffer     /* must be as large as StringInfo.Buffer*/
  48.  
  49.     STRING Reserved SIZE 16  /* 4*SIZEOF(LONGINT) */    /* set TO 0             */
  50. END STRUCT 
  51.  
  52. STRUCT SGWork    
  53.     /* set up when gadget is first activated    */
  54.  
  55.     GadgetPtr  _Gadget     /* the contestant itself    */
  56.     StringInfoPtr  StringInfo     /* easy access to sinfo     */
  57.     ADDRESS   WorkBuffer     /* intuition's planned result   */
  58.     ADDRESS   PrevBuffer     /* what was there before    */
  59.     LONGINT       Modes       /* current mode         */
  60.  
  61.     /* modified for each input event    */
  62.     InputEventPtr  IEvent     /* actual event: do not change  */
  63.     SHORTINT       Code        /* character code,  if one byte  */
  64.     SHORTINT        BufferPos   /* cursor position      */
  65.     SHORTINT        NumChars 
  66.     LONGINT       Actions     /* what Intuition will do   */
  67.     LONGINT        _LongInt     /* temp storage for longint */
  68.  
  69.     GadgetInfoPtr  GadgetInfo     /* see cghooks.h        */
  70.     SHORTINT       EditOp      /* from constants below     */
  71. END STRUCT 
  72.  
  73. /* SGWork.EditOp -
  74.  * These values indicate what basic type of operation the global
  75.  * editing hook has performed on the string before your gadget's custom
  76.  * editing hook gets called.  You do not have to be concerned with the
  77.  * value your custom hook leaves in the EditOp field,  only if you
  78.  * write a global editing hook.
  79.  *
  80.  * For most of these general edit operations,  you'll want to compare
  81.  * the BufferPos and NumChars of the StringInfo (before global editing)
  82.  * and SGWork (after global editing).
  83.  */
  84.  
  85. #define EO_NOOP     (&H0001)
  86.     /* did nothing                          */
  87. #define EO_DELBACKWARD  (&H0002)
  88.     /* deleted some chars (maybe 0).                */
  89. #define EO_DELFORWARD   (&H0003)
  90.     /* deleted some characters under and in front of the cursor */
  91. #define EO_MOVECURSOR   (&H0004)
  92.     /* moved the cursor                     */
  93. #define EO_ENTER    (&H0005)
  94.     /* "enter" or "return" key,  terminate               */
  95. #define EO_RESET    (&H0006)
  96.     /* current Intuition-style undo                 */
  97. #define EO_REPLACECHAR  (&H0007)
  98.     /* replaced one character and (maybe) advanced cursor       */
  99. #define EO_INSERTCHAR   (&H0008)
  100.     /* inserted one BYTE into string or added one at end        */
  101. #define EO_BADFORMAT    (&H0009)
  102.     /* didn't like the text data,  e.g.,  Bad LONGINT         */
  103. #define EO_BIGCHANGE    (&H000A)    /* unused by Intuition  */
  104.     /* complete or major change to the text,  e.g. new string    */
  105. #define EO_UNDO     (&H000B)    /* unused by Intuition  */
  106.     /* some other style of undo                 */
  107. #define EO_CLEAR    (&H000C)
  108.     /* clear the string                     */
  109. #define EO_SPECIAL  (&H000D)    /* unused by Intuition  */
  110.     /* some operation that doesn't fit into the categories here */
  111.  
  112.  
  113. /* Mode Flags definitions (ONLY first group allowed as InitialModes)    */
  114. #define SGM_REPLACE (&H1&)   /* replace mode         */
  115. /* please initialize StringInfo with in-range value of BufferPos
  116.  * if you are using SGM_REPLACE mode.
  117.  */
  118.  
  119. #define SGM_FIXEDFIELD  (&H2&)   /* fixed length buffer      */
  120.                     /* always set SGM_REPLACE,  too  */
  121. #define SGM_NOFILTER    (&H4&)   /* don't filter control chars   */
  122.  
  123. /* SGM_EXITHELP is new for V37,  and ignored by V36: */
  124. #define SGM_EXITHELP    (&H80&)   /* EXIT with code = &H5F IF HELP hit */
  125.  
  126.  
  127. /* These Mode Flags are for internal use only               */
  128. #define SGM_NOCHANGE    (&H8&)   /* no edit changes yet      */
  129. #define SGM_NOWORKB (&H10&)   /* Buffer == PrevBuffer     */
  130. #define SGM_CONTROL (&H20&)   /* control BYTE escape mode */
  131. #define SGM_LONGINT (&H40&)   /* an intuition LONGINT GADGET  */
  132.  
  133. /* String Gadget Action Flags (put in SGWork.Actions by EditHook)   */
  134. #define SGA_USE     (&H1&)  /* use contents of SGWork       */
  135. #define SGA_END     (&H2&)  /* terminate gadget,  code in Code field */
  136. #define SGA_BEEP    (&H4&)  /* flash the screen for the user    */
  137. #define SGA_REUSE   (&H8&)  /* reuse input event            */
  138. #define SGA_REDISPLAY   (&H10&) /* gadget visuals changed       */
  139.  
  140. /* New for V37: */
  141. #define SGA_NEXTACTIVE  (&H20&) /* Make next possible gadget active.    */
  142. #define SGA_PREVACTIVE  (&H40&) /* Make previous possible gadget active.*/
  143.  
  144. /* function id for only existing custom string gadget edit hook */
  145.  
  146. #define SGH_KEY     (1&)    /* process editing keystroke        */
  147. #define SGH_CLICK   (2&)    /* process mouse click cursor position  */
  148.  
  149. /* Here's a brief summary of how the custom string gadget edit hook works:
  150.  *  You provide a hook in StringInfo.Extension.EditHook.
  151.  *  The hook is called in the standard way with the 'object'
  152.  *  a pointer to SGWork,  and the 'message' a pointer to a command
  153.  *  block,  starting either with (longword) SGH_KEY,  SGH_CLICK, 
  154.  *  or something new.
  155.  *
  156.  *  You return 0 if you don't understand the command (SGH_KEY is
  157.  *  required and assumed).  Return non-zero if you implement the
  158.  *  command.
  159.  *
  160.  *   SGH_KEY:
  161.  *  There are no parameters following the command longword.
  162.  *
  163.  *  Intuition will put its idea of proper values in the SGWork
  164.  *  before calling you,  and if you leave SGA_USE set in the
  165.  *  SGWork.Actions field,  Intuition will use the values
  166.  *  found in SGWork fields WorkBuffer,  NumChars,  BufferPos, 
  167.  *  and LongInt,  copying the WorkBuffer back to the StringInfo
  168.  *  Buffer.
  169.  *
  170.  *  NOTE WELL: You may NOT change other SGWork fields.
  171.  *
  172.  *  If you clear SGA_USE,  the string gadget will be unchanged.
  173.  *
  174.  *  If you set SGA_END,  Intuition will terminate the activation
  175.  *  of the string gadget.  If you also set SGA_REUSE,  Intuition
  176.  *  will reuse the input event after it deactivates your gadget.
  177.  *
  178.  *  In this case,  Intuition will put the value found in SGWork.Code
  179.  *  into the IntuiMessage.Code field of the IDCMP_GADGETUP message it
  180.  *  sends to the application.
  181.  *
  182.  *  If you set SGA_BEEP,  Intuition will call DisplayBeep()  use
  183.  *  this if the user has typed in error,  or buffer is full.
  184.  *
  185.  *  Set SGA_REDISPLAY if the changes to the gadget warrant a
  186.  *  gadget redisplay.  Note: cursor movement requires a redisplay.
  187.  *
  188.  *  Starting in V37,  you may set SGA_PREVACTIVE or SGA_NEXTACTIVE
  189.  *  when you set SGA_END.  This tells Intuition that you want
  190.  *  the next or previous gadget with GFLG_TABCYCLE to be activated.
  191.  *
  192.  *   SGH_CLICK:
  193.  *  This hook command is called when Intuition wants to position
  194.  *  the cursor in response to a mouse click in the string gadget.
  195.  *
  196.  *  Again,  here are no parameters following the command longword.
  197.  *
  198.  *  This time,  Intuition has already calculated the mouse position
  199.  *  character cell and put it in SGWork.BufferPos.  The previous
  200.  *  BufferPos value remains in the SGWork.StringInfo.BufferPos.
  201.  *
  202.  *  Intuition will again use the SGWork fields listed above for
  203.  *  SGH_KEY.  One restriction is that you are NOT allowed to set
  204.  *  SGA_END or SGA_REUSE for this command.  Intuition will not
  205.  *  stand for a gadget which goes inactive when you click in it.
  206.  *
  207.  *  You should always leave the SGA_REDISPLAY flag set,  since Intuition
  208.  *  uses this processing when activating a string gadget.
  209.  */
  210.  
  211. #endif
  212.