Mac OS 9
CursorDevices.h
Go to the documentation of this file.
1 
19 #ifndef __CURSORDEVICES__
20 #define __CURSORDEVICES__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __MIXEDMODE__
27 #include <MixedMode.h>
28 #endif
29 
30 #if PRAGMA_ONCE
31 #pragma once
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #if PRAGMA_IMPORT
40 #pragma import on
41 #endif
42 
43 #if PRAGMA_STRUCT_ALIGN
44 #pragma options align = mac68k
45 #elif PRAGMA_STRUCT_PACKPUSH
46 #pragma pack(push, 2)
47 #elif PRAGMA_STRUCT_PACK
48 #pragma pack(2)
49 #endif
50 
67  typedef short ButtonOpcode;
68  /* ButtonOpcodes */
69  enum
70  {
71  kButtonNoOp = 0, /* No action for this button */
72  kButtonSingleClick = 1, /* Normal mouse button */
73  kButtonDoubleClick = 2, /* Click-release-click when pressed */
74  kButtonClickLock = 3 /* Click on press, release on next press */
75  };
76 
77  enum
78  {
79  kButtonCustom = 6 /* Custom behavior, data = CursorDeviceCustomButtonUPP */
80  };
81 
82  /* Device Classes */
83  enum
84  {
85  kDeviceClassAbsolute = 0, /* a flat-response device */
86  kDeviceClassMouse = 1, /* mechanical or optical mouse */
87  kDeviceClassTrackball = 2, /* trackball */
88  kDeviceClassTrackPad = 3
89  };
90 
91  enum
92  {
93  kDeviceClass3D = 6 /* a 3D pointing device */
94  };
95 
96  /* Structures used in Cursor Device Manager calls */
97  struct CursorData
98  {
99  struct CursorData *nextCursorData; /* next in global list */
100  Ptr displayInfo; /* unused (reserved for future) */
101  Fixed whereX; /* horizontal position */
102  Fixed whereY; /* vertical position */
103  Point where; /* the pixel position */
104  Boolean isAbs; /* has been stuffed with absolute coords */
105  UInt8 buttonCount; /* number of buttons currently pressed */
106  long screenRes; /* pixels per inch on the current display */
107  short privateFields[22]; /* fields use internally by CDM */
108  };
109  typedef struct CursorData CursorData;
110  typedef CursorData *CursorDataPtr;
112  {
113  struct CursorDevice
114  *nextCursorDevice; /* pointer to next record in linked list */
115  CursorData *whichCursor; /* pointer to data for target cursor */
116  long refCon; /* application-defined */
117  long unused; /* reserved for future */
118  OSType devID; /* device identifier (from ADB reg 1) */
119  Fixed resolution; /* units/inch (orig. from ADB reg 1) */
120  UInt8 devClass; /* device class (from ADB reg 1) */
121  UInt8 cntButtons; /* number of buttons (from ADB reg 1) */
122  UInt8 filler1; /* reserved for future */
123  UInt8 buttons; /* state of all buttons */
124  UInt8 buttonOp[8]; /* action performed per button */
125  unsigned long
126  buttonTicks[8]; /* ticks when button last went up (for debounce) */
127  long buttonData[8]; /* data for the button operation */
128  unsigned long doubleClickTime; /* device-specific double click speed */
129  Fixed acceleration; /* current acceleration */
130  short privateFields[15]; /* fields used internally to CDM */
131  };
132  typedef struct CursorDevice CursorDevice;
133  typedef CursorDevice *CursorDevicePtr;
134  /* for use with CursorDeviceButtonOp when opcode = kButtonCustom */
135  typedef CALLBACK_API_REGISTER68K(void, CursorDeviceCustomButtonProcPtr,
136  (CursorDevicePtr ourDevice, short button));
137  typedef REGISTER_UPP_TYPE(CursorDeviceCustomButtonProcPtr)
138  CursorDeviceCustomButtonUPP;
139 #if CALL_NOT_IN_CARBON
148  CursorDeviceCustomButtonUPP
149  NewCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonProcPtr userRoutine);
150 #if !OPAQUE_UPP_TYPES
151  enum
152  {
153  uppCursorDeviceCustomButtonProcInfo = 0x000ED802
154  }; /* register no_return_value Func(4_bytes:A2, 2_bytes:D3) */
155 #ifdef __cplusplus
156  inline CursorDeviceCustomButtonUPP
157  NewCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonProcPtr userRoutine)
158  {
159  return (CursorDeviceCustomButtonUPP)NewRoutineDescriptor(
160  (ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo,
161  GetCurrentArchitecture());
162  }
163 #else
164 #define NewCursorDeviceCustomButtonUPP(userRoutine) \
165  (CursorDeviceCustomButtonUPP) NewRoutineDescriptor( \
166  (ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, \
167  GetCurrentArchitecture())
168 #endif
169 #endif
170 
179  void
180  DisposeCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonUPP userUPP);
181 #if !OPAQUE_UPP_TYPES
182 #ifdef __cplusplus
183  inline void
184  DisposeCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonUPP userUPP)
185  {
186  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
187  }
188 #else
189 #define DisposeCursorDeviceCustomButtonUPP(userUPP) \
190  DisposeRoutineDescriptor(userUPP)
191 #endif
192 #endif
193 
202  void
204  CursorDeviceCustomButtonUPP userUPP);
205 #if !OPAQUE_UPP_TYPES && \
206  (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
207 #ifdef __cplusplus
208  inline void
209  InvokeCursorDeviceCustomButtonUPP(CursorDevicePtr ourDevice, short button,
210  CursorDeviceCustomButtonUPP userUPP)
211  {
212  CALL_TWO_PARAMETER_UPP(userUPP, uppCursorDeviceCustomButtonProcInfo,
213  ourDevice, button);
214  }
215 #else
216 #define InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userUPP) \
217  CALL_TWO_PARAMETER_UPP((userUPP), uppCursorDeviceCustomButtonProcInfo, \
218  (ourDevice), (button))
219 #endif
220 #endif
221 
222 #endif /* CALL_NOT_IN_CARBON */
223 
224 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
225 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
226 #define NewCursorDeviceCustomButtonProc(userRoutine) \
227  NewCursorDeviceCustomButtonUPP(userRoutine)
228 #define CallCursorDeviceCustomButtonProc(userRoutine, ourDevice, button) \
229  InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userRoutine)
230 #endif /* CALL_NOT_IN_CARBON */
231 
232 #if CALL_NOT_IN_CARBON
241  OSErr
242  CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY);
243 
252  OSErr
253  CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY);
254 
263  OSErr
265 
274  OSErr
275  CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons);
276 
285  OSErr
287 
296  OSErr
298 
307  OSErr
308  CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber,
309  ButtonOpcode opcode, long data);
310 
319  OSErr
320  CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons);
321 
330  OSErr
332 
341  OSErr
342  CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks);
343 
352  OSErr
354 
363  OSErr
365 
374  OSErr
376 
385  OSErr
387 
397 #endif /* CALL_NOT_IN_CARBON */
398 
399 #if OLDROUTINENAMES
400 #if CALL_NOT_IN_CARBON
409  OSErr
410  CrsrDevMoveTo(CursorDevicePtr ourDevice, long absX, long absY);
411 
420  OSErr
421  CrsrDevNextDevice(CursorDevicePtr *ourDevice);
422 
423 #endif /* CALL_NOT_IN_CARBON */
424 
425 #endif /* OLDROUTINENAMES */
426 
427 #if PRAGMA_STRUCT_ALIGN
428 #pragma options align = reset
429 #elif PRAGMA_STRUCT_PACKPUSH
430 #pragma pack(pop)
431 #elif PRAGMA_STRUCT_PACK
432 #pragma pack()
433 #endif
434 
435 #ifdef PRAGMA_IMPORT_OFF
436 #pragma import off
437 #elif PRAGMA_IMPORT
438 #pragma import reset
439 #endif
440 
441 #ifdef __cplusplus
442 }
443 #endif
444 
445 #endif /* __CURSORDEVICES__ */
OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
CursorDeviceCustomButtonUPP NewCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonProcPtr userRoutine)
OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
short ButtonOpcode
Definition: CursorDevices.h:67
OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
void DisposeCursorDeviceCustomButtonUPP(CursorDeviceCustomButtonUPP userUPP)
void InvokeCursorDeviceCustomButtonUPP(CursorDevicePtr ourDevice, short button, CursorDeviceCustomButtonUPP userUPP)
Basic Macintosh data types.
long Fixed
Definition: MacTypes.h:153
unsigned char Boolean
Definition: MacTypes.h:318
Mixed Mode Manager Interfaces.
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
typedef CALLBACK_API_REGISTER68K(void, SIInterruptProcPtr,(SPBPtr inParamPtr, Ptr dataBuffer, short peakAmplitude, long sampleSize))
typedef REGISTER_UPP_TYPE(HighHookProcPtr) HighHookUPP
Definition: CursorDevices.h:98
Definition: CursorDevices.h:112
Definition: MacTypes.h:520