home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Reference_Library / lib_examples / custompointer.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-21  |  2.8 KB  |  105 lines

  1. ;/* custompointer.c - Execute me to compile me with SAS C 5.10
  2. LC -b1 -cfistq -v -y -j73 custompointer.c
  3. Blink FROM LIB:c.o,custompointer.o TO custompointer LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. **
  6. ** The program shows how to set the pointer for a window.  In this
  7. ** example, the pointer imagery is changed to a stopwatch symbol which
  8. ** could be used to indicate a busy period.
  9. **
  10. ** custompointer.c - Show the use of a custom busy pointer, as well as
  11. ** using a requester to block input to a window.
  12. */
  13. #define INTUI_V36_NAMES_ONLY
  14.  
  15. #include <exec/types.h>
  16. #include <exec/libraries.h>
  17. #include <intuition/intuition.h>
  18.  
  19. #include <clib/exec_protos.h>
  20. #include <clib/dos_protos.h>
  21. #include <clib/intuition_protos.h>
  22.  
  23. #ifdef LATTICE
  24. int CXBRK(void)    { return(0); }  /* Disable Lattice CTRL/C handling */
  25. int chkabort(void) { return(0); }  /* really */
  26. #endif
  27.  
  28. struct Library *IntuitionBase;
  29.  
  30.  
  31. UWORD __chip waitPointer[] =
  32.     {
  33.     0x0000, 0x0000,     /* reserved, must be NULL */
  34.  
  35.     0x0400, 0x07C0,
  36.     0x0000, 0x07C0,
  37.     0x0100, 0x0380,
  38.     0x0000, 0x07E0,
  39.     0x07C0, 0x1FF8,
  40.     0x1FF0, 0x3FEC,
  41.     0x3FF8, 0x7FDE,
  42.     0x3FF8, 0x7FBE,
  43.     0x7FFC, 0xFF7F,
  44.     0x7EFC, 0xFFFF,
  45.     0x7FFC, 0xFFFF,
  46.     0x3FF8, 0x7FFE,
  47.     0x3FF8, 0x7FFE,
  48.     0x1FF0, 0x3FFC,
  49.     0x07C0, 0x1FF8,
  50.     0x0000, 0x07E0,
  51.  
  52.     0x0000, 0x0000,     /* reserved, must be NULL */
  53.     };
  54.  
  55.  
  56. /*
  57. ** The main() routine
  58. */
  59. VOID main(int argc, char **argv)
  60. {
  61. struct Window *win;
  62. struct Requester null_request;
  63. extern UWORD __chip waitPointer[];
  64.  
  65. if (IntuitionBase = OpenLibrary("intuition.library",37))
  66.     {
  67.     /* the window is opened as active (WA_Activate) so that the busy
  68.     ** pointer will be visible.  If the window was not active, the
  69.     ** user would have to activate it to see the change in the pointer.
  70.     */
  71.     if (win = OpenWindowTags(NULL,
  72.                              WA_Activate, TRUE,
  73.                              TAG_END))
  74.         {
  75.         /* a NULL requester can be used to block input
  76.         ** in a window without any imagery provided.
  77.         */
  78.         InitRequester(&null_request);
  79.  
  80.         Delay(50);  /* simulate activity in the program. */
  81.  
  82.         /* Put up the requester to block user input in the window,
  83.         ** and set the pointer to the busy pointer.
  84.         */
  85.         if (Request(&null_request, win))
  86.             {
  87.             SetPointer(win, waitPointer, 16, 16, -6, 0);
  88.  
  89.             Delay(100);  /* simulate activity in the program. */
  90.  
  91.             /* clear the pointer (which resets the window to the default
  92.             ** pointer) and remove the requester.
  93.             */
  94.             ClearPointer(win);
  95.             EndRequest(&null_request, win);
  96.             }
  97.  
  98.         Delay(100);  /* simulate activity in the program. */
  99.  
  100.         CloseWindow(win);
  101.         }
  102.     CloseLibrary(IntuitionBase);
  103.     }
  104. }
  105.