home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / rkrm.lha / RKRM / Intuition / Mouse_Keyboard / custompointer.c < prev    next >
C/C++ Source or Header  |  1992-09-03  |  4KB  |  130 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.  
  7. /*
  8. Copyright (c) 1992 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga, Inc. for
  11. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  12. published by Addison-Wesley (ISBN 0-201-56774-1).
  13.  
  14. The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
  15. information on the correct usage of the techniques and operating system
  16. functions presented in these examples.  The source and executable code
  17. of these examples may only be distributed in free electronic form, via
  18. bulletin board or as part of a fully non-commercial and freely
  19. redistributable diskette.  Both the source and executable code (including
  20. comments) must be included, without modification, in any copy.  This
  21. example may not be published in printed form or distributed with any
  22. commercial product.  However, the programming techniques and support
  23. routines set forth in these examples may be used in the development
  24. of original executable software products for Commodore Amiga computers.
  25.  
  26. All other rights reserved.
  27.  
  28. This example is provided "as-is" and is subject to change; no
  29. warranties are made.  All use is at your own risk. No liability or
  30. responsibility is assumed.
  31. */
  32.  
  33.  
  34. /*
  35. ** custompointer.c - Show the use of a custom busy pointer, as well as
  36. ** using a requester to block input to a window.
  37. */
  38. #define INTUI_V36_NAMES_ONLY
  39.  
  40. #include <exec/types.h>
  41. #include <exec/libraries.h>
  42. #include <intuition/intuition.h>
  43.  
  44. #include <clib/exec_protos.h>
  45. #include <clib/dos_protos.h>
  46. #include <clib/intuition_protos.h>
  47.  
  48. #ifdef LATTICE
  49. int CXBRK(void)    { return(0); }  /* Disable Lattice CTRL/C handling */
  50. int chkabort(void) { return(0); }  /* really */
  51. #endif
  52.  
  53. struct Library *IntuitionBase;
  54.  
  55.  
  56. UWORD __chip waitPointer[] =
  57.     {
  58.     0x0000, 0x0000,     /* reserved, must be NULL */
  59.  
  60.     0x0400, 0x07C0,
  61.     0x0000, 0x07C0,
  62.     0x0100, 0x0380,
  63.     0x0000, 0x07E0,
  64.     0x07C0, 0x1FF8,
  65.     0x1FF0, 0x3FEC,
  66.     0x3FF8, 0x7FDE,
  67.     0x3FF8, 0x7FBE,
  68.     0x7FFC, 0xFF7F,
  69.     0x7EFC, 0xFFFF,
  70.     0x7FFC, 0xFFFF,
  71.     0x3FF8, 0x7FFE,
  72.     0x3FF8, 0x7FFE,
  73.     0x1FF0, 0x3FFC,
  74.     0x07C0, 0x1FF8,
  75.     0x0000, 0x07E0,
  76.  
  77.     0x0000, 0x0000,     /* reserved, must be NULL */
  78.     };
  79.  
  80.  
  81. /*
  82. ** The main() routine
  83. */
  84. VOID main(int argc, char **argv)
  85. {
  86. struct Window *win;
  87. struct Requester null_request;
  88. extern UWORD __chip waitPointer[];
  89.  
  90. if (IntuitionBase = OpenLibrary("intuition.library",37))
  91.     {
  92.     /* the window is opened as active (WA_Activate) so that the busy
  93.     ** pointer will be visible.  If the window was not active, the
  94.     ** user would have to activate it to see the change in the pointer.
  95.     */
  96.     if (win = OpenWindowTags(NULL,
  97.                              WA_Activate, TRUE,
  98.                              TAG_END))
  99.         {
  100.         /* a NULL requester can be used to block input
  101.         ** in a window without any imagery provided.
  102.         */
  103.         InitRequester(&null_request);
  104.  
  105.         Delay(50);  /* simulate activity in the program. */
  106.  
  107.         /* Put up the requester to block user input in the window,
  108.         ** and set the pointer to the busy pointer.
  109.         */
  110.         if (Request(&null_request, win))
  111.             {
  112.             SetPointer(win, waitPointer, 16, 16, -6, 0);
  113.  
  114.             Delay(100);  /* simulate activity in the program. */
  115.  
  116.             /* clear the pointer (which resets the window to the default
  117.             ** pointer) and remove the requester.
  118.             */
  119.             ClearPointer(win);
  120.             EndRequest(&null_request, win);
  121.             }
  122.  
  123.         Delay(100);  /* simulate activity in the program. */
  124.  
  125.         CloseWindow(win);
  126.         }
  127.     CloseLibrary(IntuitionBase);
  128.     }
  129. }
  130.