QD3DViewer.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:22k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DViewer.h
  3.  
  4.      Contains:   MacOS Viewer Controller Interface File.
  5.  
  6.      Version:    Technology: Quickdraw 3D 1.6
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1995-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DVIEWER__
  18. #define __QD3DVIEWER__
  19. #ifndef __QD3D__
  20. #include "QD3D.h"
  21. #endif
  22. #ifndef __QD3DGROUP__
  23. #include "QD3DGroup.h"
  24. #endif
  25. #if TARGET_OS_MAC
  26. #ifndef __EVENTS__
  27. #include "Events.h"
  28. #endif
  29. #ifndef __MACTYPES__
  30. #include "MacTypes.h"
  31. #endif
  32. #ifndef __QUICKDRAW__
  33. #include "Quickdraw.h"
  34. #endif
  35. #endif  /* TARGET_OS_MAC */
  36. #if PRAGMA_ONCE
  37. #pragma once
  38. #endif
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. #if PRAGMA_IMPORT
  43. #pragma import on
  44. #endif
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=power
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52. #if PRAGMA_ENUM_ALWAYSINT
  53.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  54.         #define __QD3DVIEWER__RESTORE_TWOBYTEINTS
  55.         #pragma fourbyteints on
  56.     #endif
  57.     #pragma enumsalwaysint on
  58. #elif PRAGMA_ENUM_OPTIONS
  59.     #pragma option enum=int
  60. #elif PRAGMA_ENUM_PACK
  61.     #if __option(pack_enums)
  62.         #define __QD3DVIEWER__RESTORE_PACKED_ENUMS
  63.         #pragma options(!pack_enums)
  64.     #endif
  65. #endif
  66. typedef void *                          TQ3ViewerObject;
  67. typedef CALLBACK_API_C( TQ3Status , TQ3ViewerWindowResizeCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  68. typedef CALLBACK_API_C( TQ3Status , TQ3ViewerPaneResizeNotifyCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  69. #if TARGET_OS_MAC
  70. typedef CALLBACK_API_C( OSErr , TQ3ViewerDrawingCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  71. enum {
  72.     kQ3ViewerShowBadge          = 1 << 0,
  73.     kQ3ViewerActive             = 1 << 1,
  74.     kQ3ViewerControllerVisible  = 1 << 2,
  75.     kQ3ViewerDrawFrame          = 1 << 3,
  76.     kQ3ViewerDraggingOff        = 1 << 4,
  77.     kQ3ViewerButtonCamera       = 1 << 5,
  78.     kQ3ViewerButtonTruck        = 1 << 6,
  79.     kQ3ViewerButtonOrbit        = 1 << 7,
  80.     kQ3ViewerButtonZoom         = 1 << 8,
  81.     kQ3ViewerButtonDolly        = 1 << 9,
  82.     kQ3ViewerButtonReset        = 1 << 10,
  83.     kQ3ViewerOutputTextMode     = 1 << 11,
  84.     kQ3ViewerDragMode           = 1 << 12,
  85.     kQ3ViewerDrawGrowBox        = 1 << 13,
  86.     kQ3ViewerDrawDragBorder     = 1 << 14,
  87.     kQ3ViewerDraggingInOff      = 1 << 15,
  88.     kQ3ViewerDraggingOutOff     = 1 << 16,
  89.     kQ3ViewerButtonOptions      = 1 << 17,
  90.     kQ3ViewerPaneGrowBox        = 1 << 18,
  91.     kQ3ViewerDefault            = 1 << 31
  92. };
  93. enum {
  94.     kQ3ViewerEmpty              = 0,
  95.     kQ3ViewerHasModel           = 1 << 0,
  96.     kQ3ViewerHasUndo            = 1 << 1
  97. };
  98. enum TQ3ViewerCameraView {
  99.     kQ3ViewerCameraRestore      = 0,
  100.     kQ3ViewerCameraFit          = 1,
  101.     kQ3ViewerCameraFront        = 2,
  102.     kQ3ViewerCameraBack         = 3,
  103.     kQ3ViewerCameraLeft         = 4,
  104.     kQ3ViewerCameraRight        = 5,
  105.     kQ3ViewerCameraTop          = 6,
  106.     kQ3ViewerCameraBottom       = 7
  107. };
  108. typedef enum TQ3ViewerCameraView TQ3ViewerCameraView;
  109. /******************************************************************************
  110.  **                                                                          **
  111.  **     Return viewer version number                                         **
  112.  **                                                                          **
  113.  *****************************************************************************/
  114. #if CALL_NOT_IN_CARBON
  115. EXTERN_API_C( OSErr )
  116. Q3ViewerGetVersion              (unsigned long *        majorRevision,
  117.                                  unsigned long *        minorRevision);
  118. /******************************************************************************
  119.  **                                                                          **
  120.  **     Return viewer release version number                                 **
  121.  **     (in 'vers' format - e.g. 0x01518000 ==> 1.5.1 release)               **
  122.  **                                                                          **
  123.  *****************************************************************************/
  124. EXTERN_API_C( OSErr )
  125. Q3ViewerGetReleaseVersion       (unsigned long *        releaseRevision);
  126. /******************************************************************************
  127.  **                                                                          **
  128.  **                     Creation and destruction                             **
  129.  **             Note that this is not a QuickDraw 3D object                  **
  130.  **                                                                          **
  131.  *****************************************************************************/
  132. EXTERN_API_C( TQ3ViewerObject )
  133. Q3ViewerNew                     (CGrafPtr               port,
  134.                                  Rect *                 rect,
  135.                                  unsigned long          flags);
  136. EXTERN_API_C( OSErr )
  137. Q3ViewerDispose                 (TQ3ViewerObject        theViewer);
  138. /******************************************************************************
  139.  **                                                                          **
  140.  **                 Functions to attach data to a viewer                     **
  141.  **                                                                          **
  142.  *****************************************************************************/
  143. EXTERN_API_C( OSErr )
  144. Q3ViewerUseFile                 (TQ3ViewerObject        theViewer,
  145.                                  long                   refNum);
  146. EXTERN_API_C( OSErr )
  147. Q3ViewerUseData                 (TQ3ViewerObject        theViewer,
  148.                                  void *                 data,
  149.                                  long                   size);
  150. /******************************************************************************
  151.  **                                                                          **
  152.  **     Functions to write data out from the Viewer                          **
  153.  **                                                                          **
  154.  *****************************************************************************/
  155. EXTERN_API_C( OSErr )
  156. Q3ViewerWriteFile               (TQ3ViewerObject        theViewer,
  157.                                  long                   refNum);
  158. EXTERN_API_C( unsigned long )
  159. Q3ViewerWriteData               (TQ3ViewerObject        theViewer,
  160.                                  Handle                 data);
  161. /******************************************************************************
  162.  **                                                                          **
  163.  **     Use this function to force the Viewer to re-draw                     **
  164.  **                                                                          **
  165.  *****************************************************************************/
  166. EXTERN_API_C( OSErr )
  167. Q3ViewerDraw                    (TQ3ViewerObject        theViewer);
  168. EXTERN_API_C( OSErr )
  169. Q3ViewerDrawContent             (TQ3ViewerObject        theViewer);
  170. EXTERN_API_C( OSErr )
  171. Q3ViewerDrawControlStrip        (TQ3ViewerObject        theViewer);
  172. /******************************************************************************
  173.  **                                                                          **
  174.  **     Function used by the Viewer to filter and handle events              **
  175.  **                                                                          **
  176.  *****************************************************************************/
  177. EXTERN_API_C( Boolean )
  178. Q3ViewerEvent                   (TQ3ViewerObject        theViewer,
  179.                                  EventRecord *          evt);
  180. /******************************************************************************
  181.  **                                                                          **
  182.  **     This function returns a PICT of the contents of the                  **
  183.  **     Viewer's window.  The application should dispose the PICT.           **
  184.  **                                                                          **
  185.  *****************************************************************************/
  186. EXTERN_API_C( PicHandle )
  187. Q3ViewerGetPict                 (TQ3ViewerObject        theViewer);
  188. /******************************************************************************
  189.  **                                                                          **
  190.  **                     Calls for dealing with Buttons                       **
  191.  **                                                                          **
  192.  *****************************************************************************/
  193. EXTERN_API_C( OSErr )
  194. Q3ViewerGetButtonRect           (TQ3ViewerObject        theViewer,
  195.                                  unsigned long          button,
  196.                                  Rect *                 rect);
  197. EXTERN_API_C( unsigned long )
  198. Q3ViewerGetCurrentButton        (TQ3ViewerObject        theViewer);
  199. EXTERN_API_C( OSErr )
  200. Q3ViewerSetCurrentButton        (TQ3ViewerObject        theViewer,
  201.                                  unsigned long          button);
  202. /******************************************************************************
  203.  **                                                                          **
  204.  **     Functions to set/get the group to be displayed by the Viewer.        **
  205.  **                                                                          **
  206.  *****************************************************************************/
  207. EXTERN_API_C( OSErr )
  208. Q3ViewerUseGroup                (TQ3ViewerObject        theViewer,
  209.                                  TQ3GroupObject         group);
  210. EXTERN_API_C( TQ3GroupObject )
  211. Q3ViewerGetGroup                (TQ3ViewerObject        theViewer);
  212. /******************************************************************************
  213.  **                                                                          **
  214.  **     Functions to set/get the color used to clear the window              **
  215.  **                                                                          **
  216.  *****************************************************************************/
  217. EXTERN_API_C( OSErr )
  218. Q3ViewerSetBackgroundColor      (TQ3ViewerObject        theViewer,
  219.                                  TQ3ColorARGB *         color);
  220. EXTERN_API_C( OSErr )
  221. Q3ViewerGetBackgroundColor      (TQ3ViewerObject        theViewer,
  222.                                  TQ3ColorARGB *         color);
  223. /******************************************************************************
  224.  **                                                                          **
  225.  **     Getting/Setting a Viewer's View object.                              **
  226.  **                                                                          **
  227.  *****************************************************************************/
  228. EXTERN_API_C( TQ3ViewObject )
  229. Q3ViewerGetView                 (TQ3ViewerObject        theViewer);
  230. EXTERN_API_C( OSErr )
  231. Q3ViewerRestoreView             (TQ3ViewerObject        theViewer);
  232. /******************************************************************************
  233.  **                                                                          **
  234.  **     Calls for setting/getting viewer flags                               **
  235.  **                                                                          **
  236.  *****************************************************************************/
  237. EXTERN_API_C( OSErr )
  238. Q3ViewerSetFlags                (TQ3ViewerObject        theViewer,
  239.                                  unsigned long          flags);
  240. EXTERN_API_C( unsigned long )
  241. Q3ViewerGetFlags                (TQ3ViewerObject        theViewer);
  242. /******************************************************************************
  243.  **                                                                          **
  244.  **     Calls related to bounds/dimensions.  Bounds is the size of           **
  245.  **     the window.  Dimensions can either be the Rect from the ViewHints    **
  246.  **     or the current dimensions of the window (if you do a Set).           **
  247.  **                                                                          **
  248.  *****************************************************************************/
  249. EXTERN_API_C( OSErr )
  250. Q3ViewerSetBounds               (TQ3ViewerObject        theViewer,
  251.                                  Rect *                 bounds);
  252. EXTERN_API_C( OSErr )
  253. Q3ViewerGetBounds               (TQ3ViewerObject        theViewer,
  254.                                  Rect *                 bounds);
  255. EXTERN_API_C( OSErr )
  256. Q3ViewerSetDimension            (TQ3ViewerObject        theViewer,
  257.                                  unsigned long          width,
  258.                                  unsigned long          height);
  259. EXTERN_API_C( OSErr )
  260. Q3ViewerGetDimension            (TQ3ViewerObject        theViewer,
  261.                                  unsigned long *        width,
  262.                                  unsigned long *        height);
  263. EXTERN_API_C( OSErr )
  264. Q3ViewerGetMinimumDimension     (TQ3ViewerObject        theViewer,
  265.                                  unsigned long *        width,
  266.                                  unsigned long *        height);
  267. /******************************************************************************
  268.  **                                                                          **
  269.  **                         Port related calls                               **
  270.  **                                                                          **
  271.  *****************************************************************************/
  272. EXTERN_API_C( OSErr )
  273. Q3ViewerSetPort                 (TQ3ViewerObject        theViewer,
  274.                                  CGrafPtr               port);
  275. EXTERN_API_C( CGrafPtr )
  276. Q3ViewerGetPort                 (TQ3ViewerObject        theViewer);
  277. /******************************************************************************
  278.  **                                                                          **
  279.  **     Adjust Cursor should be called from idle loop to allow the Viewer    **
  280.  **     to change the cursor according to the cursor position/object under   **
  281.  **     the cursor.                                                          **
  282.  **                                                                          **
  283.  *****************************************************************************/
  284. EXTERN_API_C( Boolean )
  285. Q3ViewerAdjustCursor            (TQ3ViewerObject        theViewer,
  286.                                  Point *                pt);
  287. EXTERN_API_C( OSErr )
  288. Q3ViewerCursorChanged           (TQ3ViewerObject        theViewer);
  289. /******************************************************************************
  290.  **                                                                          **
  291.  **     Returns the state of the viewer.  See the constant defined at the    **
  292.  **     top of this file.                                                    **
  293.  **                                                                          **
  294.  *****************************************************************************/
  295. EXTERN_API_C( unsigned long )
  296. Q3ViewerGetState                (TQ3ViewerObject        theViewer);
  297. /******************************************************************************
  298.  **                                                                          **
  299.  **                         Clipboard utilities                              **
  300.  **                                                                          **
  301.  *****************************************************************************/
  302. EXTERN_API_C( OSErr )
  303. Q3ViewerClear                   (TQ3ViewerObject        theViewer);
  304. EXTERN_API_C( OSErr )
  305. Q3ViewerCut                     (TQ3ViewerObject        theViewer);
  306. EXTERN_API_C( OSErr )
  307. Q3ViewerCopy                    (TQ3ViewerObject        theViewer);
  308. EXTERN_API_C( OSErr )
  309. Q3ViewerPaste                   (TQ3ViewerObject        theViewer);
  310. /******************************************************************************
  311.  **                                                                          **
  312.  **                         New Event Model                                  **
  313.  **                                                                          **
  314.  *****************************************************************************/
  315. EXTERN_API_C( Boolean )
  316. Q3ViewerMouseDown               (TQ3ViewerObject        theViewer,
  317.                                  long                   x,
  318.                                  long                   y);
  319. EXTERN_API_C( Boolean )
  320. Q3ViewerContinueTracking        (TQ3ViewerObject        theViewer,
  321.                                  long                   x,
  322.                                  long                   y);
  323. EXTERN_API_C( Boolean )
  324. Q3ViewerMouseUp                 (TQ3ViewerObject        theViewer,
  325.                                  long                   x,
  326.                                  long                   y);
  327. EXTERN_API_C( Boolean )
  328. Q3ViewerHandleKeyEvent          (TQ3ViewerObject        theViewer,
  329.                                  EventRecord *          evt);
  330. /******************************************************************************
  331.  **                                                                          **
  332.  **                                 CallBacks                                **
  333.  **                                                                          **
  334.  *****************************************************************************/
  335. EXTERN_API_C( OSErr )
  336. Q3ViewerSetDrawingCallbackMethod (TQ3ViewerObject       theViewer,
  337.                                  TQ3ViewerDrawingCallbackMethod  callbackMethod,
  338.                                  const void *           data);
  339. EXTERN_API_C( OSErr )
  340. Q3ViewerSetWindowResizeCallback (TQ3ViewerObject        theViewer,
  341.                                  TQ3ViewerWindowResizeCallbackMethod  windowResizeCallbackMethod,
  342.                                  const void *           data);
  343. EXTERN_API_C( OSErr )
  344. Q3ViewerSetPaneResizeNotifyCallback (TQ3ViewerObject    theViewer,
  345.                                  TQ3ViewerPaneResizeNotifyCallbackMethod  paneResizeNotifyCallbackMethod,
  346.                                  const void *           data);
  347. /******************************************************************************
  348.  **                                                                          **
  349.  **                                 Undo                                     **
  350.  **                                                                          **
  351.  *****************************************************************************/
  352. EXTERN_API_C( OSErr )
  353. Q3ViewerUndo                    (TQ3ViewerObject        theViewer);
  354. EXTERN_API_C( Boolean )
  355. Q3ViewerGetUndoString           (TQ3ViewerObject        theViewer,
  356.                                  char *                 str,
  357.                                  unsigned long *        cnt);
  358. /******************************************************************************
  359.  **                                                                          **
  360.  **                             Camera Support                               **
  361.  **                                                                          **
  362.  *****************************************************************************/
  363. EXTERN_API_C( OSErr )
  364. Q3ViewerGetCameraCount          (TQ3ViewerObject        theViewer,
  365.                                  unsigned long *        cnt);
  366. EXTERN_API_C( OSErr )
  367. Q3ViewerSetCameraByNumber       (TQ3ViewerObject        theViewer,
  368.                                  unsigned long          cameraNo);
  369. EXTERN_API_C( OSErr )
  370. Q3ViewerSetCameraByView         (TQ3ViewerObject        theViewer,
  371.                                  TQ3ViewerCameraView    viewType);
  372. /******************************************************************************
  373.  **                                                                          **
  374.  **                         Pop-up Button Options                            **
  375.  **                                                                          **
  376.  *****************************************************************************/
  377. EXTERN_API_C( OSErr )
  378. Q3ViewerSetRendererType         (TQ3ViewerObject        theViewer,
  379.                                  TQ3ObjectType          rendererType);
  380. EXTERN_API_C( OSErr )
  381. Q3ViewerGetRendererType         (TQ3ViewerObject        theViewer,
  382.                                  TQ3ObjectType *        rendererType);
  383. EXTERN_API_C( OSErr )
  384. Q3ViewerChangeBrightness        (TQ3ViewerObject        theViewer,
  385.                                  float                  brightness);
  386. EXTERN_API_C( OSErr )
  387. Q3ViewerSetRemoveBackfaces      (TQ3ViewerObject        theViewer,
  388.                                  TQ3Boolean             remove);
  389. EXTERN_API_C( OSErr )
  390. Q3ViewerGetRemoveBackfaces      (TQ3ViewerObject        theViewer,
  391.                                  TQ3Boolean *           remove);
  392. EXTERN_API_C( OSErr )
  393. Q3ViewerSetPhongShading         (TQ3ViewerObject        theViewer,
  394.                                  TQ3Boolean             phong);
  395. EXTERN_API_C( OSErr )
  396. Q3ViewerGetPhongShading         (TQ3ViewerObject        theViewer,
  397.                                  TQ3Boolean *           phong);
  398. #endif  /* CALL_NOT_IN_CARBON */
  399. #endif  /* TARGET_OS_MAC */
  400. #if PRAGMA_ENUM_ALWAYSINT
  401.     #pragma enumsalwaysint reset
  402.     #ifdef __QD3DVIEWER__RESTORE_TWOBYTEINTS
  403.         #pragma fourbyteints off
  404.     #endif
  405. #elif PRAGMA_ENUM_OPTIONS
  406.     #pragma option enum=reset
  407. #elif defined(__QD3DVIEWER__RESTORE_PACKED_ENUMS)
  408.     #pragma options(pack_enums)
  409. #endif
  410. #if PRAGMA_STRUCT_ALIGN
  411.     #pragma options align=reset
  412. #elif PRAGMA_STRUCT_PACKPUSH
  413.     #pragma pack(pop)
  414. #elif PRAGMA_STRUCT_PACK
  415.     #pragma pack()
  416. #endif
  417. #ifdef PRAGMA_IMPORT_OFF
  418. #pragma import off
  419. #elif PRAGMA_IMPORT
  420. #pragma import reset
  421. #endif
  422. #ifdef __cplusplus
  423. }
  424. #endif
  425. #endif /* __QD3DVIEWER__ */