home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / CursorDevices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  6.3 KB  |  176 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CursorDevices.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __CURSORDEVICES__
  18. #define __CURSORDEVICES__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if GENERATINGPOWERPC
  35. #pragma options align=mac68k
  36. #endif
  37.  
  38. #ifdef __CFM68K__
  39. #pragma lib_export on
  40. #endif
  41.  
  42. typedef short ButtonOpcode;
  43.  
  44. /* ButtonOpcodes */
  45.  
  46. enum {
  47.     kButtonNoOp                    = 0,                            /* No action for this button */
  48.     kButtonSingleClick            = 1,                            /* Normal mouse button */
  49.     kButtonDoubleClick            = 2,                            /* Click-release-click when pressed */
  50.     kButtonClickLock            = 3,                            /* Click on press, release on next press */
  51.     kButtonCustom                = 6                                /* Custom behavior, data = CursorDeviceCustomButtonUPP */
  52. };
  53.  
  54. /* Device Classes */
  55. enum {
  56.     kDeviceClassAbsolute        = 0,                            /* a flat-response device */
  57.     kDeviceClassMouse            = 1,                            /* mechanical or optical mouse */
  58.     kDeviceClassTrackball        = 2,                            /* trackball */
  59.     kDeviceClass3D                = 6                                /* a 3D pointing device */
  60. };
  61.  
  62. /* Structures used in Cursor Device Manager calls */
  63. struct CursorData {
  64.     struct CursorData                *nextCursorData;            /* next in global list */
  65.     Ptr                                displayInfo;                /* unused (reserved for future) */
  66.     Fixed                            whereX;                        /* horizontal position */
  67.     Fixed                            whereY;                        /* vertical position */
  68.     Point                            where;                        /* the pixel position */
  69.     Boolean                            isAbs;                        /* has been stuffed with absolute coords */
  70.     UInt8                            buttonCount;                /* number of buttons currently pressed */
  71.     unsigned short                    screenRes;                    /* pixels per inch on the current display */
  72.     short                            privateFields[22];            /* fields use internally by CDM */
  73. };
  74. typedef struct CursorData CursorData, *CursorDataPtr;
  75.  
  76. struct CursorDevice {
  77.     struct CursorDevice                *nextCursorDevice;            /* pointer to next record in linked list */
  78.     CursorData                        *whichCursor;                /* pointer to data for target cursor */
  79.     long                            refCon;                        /* application-defined */
  80.     long                            unused;                        /* reserved for future */
  81.     OSType                            devID;                        /* device identifier (from ADB reg 1) */
  82.     Fixed                            resolution;                    /* units/inch (orig. from ADB reg 1) */
  83.     UInt8                            devClass;                    /* device class (from ADB reg 1) */
  84.     UInt8                            cntButtons;                    /* number of buttons (from ADB reg 1) */
  85.     UInt8                            filler1;                    /* reserved for future */
  86.     UInt8                            buttons;                    /* state of all buttons */
  87.     UInt8                            buttonOp[8];                /* action performed per button */
  88.     unsigned long                    buttonTicks[8];                /* ticks when button last went up (for debounce) */
  89.     long                            buttonData[8];                /* data for the button operation */
  90.     unsigned long                    doubleClickTime;            /* device-specific double click speed */
  91.     Fixed                            acceleration;                /* current acceleration */
  92.     short                            privateFields[15];            /* fields used internally to CDM */
  93. };
  94. typedef struct CursorDevice CursorDevice, *CursorDevicePtr;
  95.  
  96. /* for use with CursorDeviceButtonOp when opcode = kButtonCustom */
  97. /*
  98.         CursorDeviceCustomButtonProcPtr uses register based parameters on the 68k and cannot
  99.         be written in or called from a high-level language without the help of
  100.         mixed mode or assembly glue.
  101.  
  102.         In:
  103.          => ourDevice       A2.L
  104.          => button          D3.W
  105. */
  106.  
  107. #if GENERATINGCFM
  108. typedef UniversalProcPtr CursorDeviceCustomButtonUPP;
  109. #else
  110. typedef Register68kProcPtr CursorDeviceCustomButtonUPP;
  111. #endif
  112.  
  113. enum {
  114.     uppCursorDeviceCustomButtonProcInfo = kRegisterBased
  115.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA2, SIZE_CODE(sizeof(CursorDevicePtr)))
  116.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterD3, SIZE_CODE(sizeof(short)))
  117. };
  118.  
  119. #if GENERATINGCFM
  120. #define NewCursorDeviceCustomButtonProc(userRoutine)        \
  121.         (CursorDeviceCustomButtonUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, GetCurrentArchitecture())
  122. #else
  123. #define NewCursorDeviceCustomButtonProc(userRoutine)        \
  124.         ((CursorDeviceCustomButtonUPP) (userRoutine))
  125. #endif
  126.  
  127. #if GENERATINGCFM
  128. #define CallCursorDeviceCustomButtonProc(userRoutine, ourDevice, button)        \
  129.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, (ourDevice), (button))
  130. #else
  131. /* (*CursorDeviceCustomButtonProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  132. #endif
  133.  
  134. extern pascal OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
  135.  TWOWORDINLINE(0x7000, 0xAADB);
  136. extern pascal OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
  137.  TWOWORDINLINE(0x7001, 0xAADB);
  138. extern pascal OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
  139.  TWOWORDINLINE(0x7002, 0xAADB);
  140. extern pascal OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
  141.  TWOWORDINLINE(0x7003, 0xAADB);
  142. extern pascal OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
  143.  TWOWORDINLINE(0x7004, 0xAADB);
  144. extern pascal OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
  145.  TWOWORDINLINE(0x7005, 0xAADB);
  146. extern pascal OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
  147.  TWOWORDINLINE(0x7006, 0xAADB);
  148. extern pascal OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
  149.  TWOWORDINLINE(0x7007, 0xAADB);
  150. extern pascal OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
  151.  TWOWORDINLINE(0x7008, 0xAADB);
  152. extern pascal OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
  153.  TWOWORDINLINE(0x7009, 0xAADB);
  154. extern pascal OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
  155.  TWOWORDINLINE(0x700A, 0xAADB);
  156. extern pascal OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
  157.  TWOWORDINLINE(0x700B, 0xAADB);
  158. extern pascal OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
  159.  TWOWORDINLINE(0x700C, 0xAADB);
  160. extern pascal OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
  161.  TWOWORDINLINE(0x700D, 0xAADB);
  162.  
  163. #ifdef __CFM68K__
  164. #pragma lib_export off
  165. #endif
  166.  
  167. #if GENERATINGPOWERPC
  168. #pragma options align=reset
  169. #endif
  170.  
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174.  
  175. #endif /* __CURSORDEVICES__ */
  176.