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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       HyperXCmd.h
  3.  
  4.      Contains:   Interfaces for HyperCard XCMD's
  5.  
  6.      Version:    Technology: HyperCard 2.3
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1987-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 __HYPERXCMD__
  18. #define __HYPERXCMD__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __FP__
  23. #include "fp.h"
  24. #endif
  25. #ifndef __EVENTS__
  26. #include "Events.h"
  27. #endif
  28. #ifndef __TEXTEDIT__
  29. #include "TextEdit.h"
  30. #endif
  31. #ifndef __MENUS__
  32. #include "Menus.h"
  33. #endif
  34. #ifndef __STANDARDFILE__
  35. #include "StandardFile.h"
  36. #endif
  37. #if PRAGMA_ONCE
  38. #pragma once
  39. #endif
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46. #if PRAGMA_STRUCT_ALIGN
  47.     #pragma options align=mac68k
  48. #elif PRAGMA_STRUCT_PACKPUSH
  49.     #pragma pack(push, 2)
  50. #elif PRAGMA_STRUCT_PACK
  51.     #pragma pack(2)
  52. #endif
  53. /* result codes */
  54. enum {
  55.     xresSucc                    = 0,
  56.     xresFail                    = 1,
  57.     xresNotImp                  = 2
  58. };
  59. /* XCMDBlock constants for event.what... */
  60. enum {
  61.     xOpenEvt                    = 1000,                         /* the first event after you are created */
  62.     xCloseEvt                   = 1001,                         /* your window is being forced close (Quit?) */
  63.     xGiveUpEditEvt              = 1002,                         /* you are losing Edit... */
  64.     xGiveUpSoundEvt             = 1003,                         /* you are losing the sound channel... */
  65.     xHidePalettesEvt            = 1004,                         /* someone called HideHCPalettes */
  66.     xShowPalettesEvt            = 1005,                         /* someone called ShowHCPalettes */
  67.     xEditUndo                   = 1100,                         /* Edit--Undo */
  68.     xEditCut                    = 1102,                         /* Edit--Cut */
  69.     xEditCopy                   = 1103,                         /* Edit--Copy */
  70.     xEditPaste                  = 1104,                         /* Edit--Paste */
  71.     xEditClear                  = 1105,                         /* Edit--Clear */
  72.     xSendEvt                    = 1200,                         /* script has sent you a message (text) */
  73.     xSetPropEvt                 = 1201,                         /* set a window property */
  74.     xGetPropEvt                 = 1202,                         /* get a window property */
  75.     xCursorWithin               = 1300,                         /* cursor is within the window */
  76.     xMenuEvt                    = 1400,                         /* user has selected an item in your menu */
  77.     xMBarClickedEvt             = 1401,                         /* a menu is about to be shown--update if needed */
  78.     xShowWatchInfoEvt           = 1501,                         /* for variable and message watchers */
  79.     xScriptErrorEvt             = 1502,                         /* place the insertion point */
  80.     xDebugErrorEvt              = 1503,                         /* user clicked "Debug" at a complaint */
  81.     xDebugStepEvt               = 1504,                         /* hilite the line */
  82.     xDebugTraceEvt              = 1505,                         /* same as step but tracing */
  83.     xDebugFinishedEvt           = 1506                          /* script ended */
  84. };
  85. enum {
  86.     paletteProc                 = 2048,                         /* Windoid with grow box */
  87.     palNoGrowProc               = 2052,                         /* standard Windoid defproc */
  88.     palZoomProc                 = 2056,                         /* Windoid with zoom and grow */
  89.     palZoomNoGrow               = 2060                          /* Windoid with zoom and no grow */
  90. };
  91. enum {
  92.     hasZoom                     = 8,
  93.     hasTallTBar                 = 2,
  94.     toggleHilite                = 1
  95. };
  96. /* paramCount is set to these constants when first calling special XThings */
  97. enum {
  98.     xMessageWatcherID           = -2,
  99.     xVariableWatcherID          = -3,
  100.     xScriptEditorID             = -4,
  101.     xDebuggerID                 = -5
  102. };
  103. /* XTalkObjectPtr->objectKind values */
  104. enum {
  105.     stackObj                    = 1,
  106.     bkgndObj                    = 2,
  107.     cardObj                     = 3,
  108.     fieldObj                    = 4,
  109.     buttonObj                   = 5
  110. };
  111. /* selectors for ShowHCAlert's dialogs (shown as buttonID:buttonText) */
  112. enum {
  113.     errorDlgID                  = 1,                            /* 1:OK (default) */
  114.     confirmDlgID                = 2,                            /* 1:OK (default) and 2:Cancel */
  115.     confirmDelDlgID             = 3,                            /* 1:Cancel (default) and 2:Delete */
  116.     yesNoCancelDlgID            = 4                             /* 1:Yes (default), 2:Cancel, and 3:No */
  117. };
  118. /* type definitions */
  119. struct XCmdBlock {
  120.     short                           paramCount;                 /* If = -1 then new use for XWindoids */
  121.     Handle                          params[16];
  122.     Handle                          returnValue;
  123.     Boolean                         passFlag;
  124.     SignedByte                      filler1;
  125.     UniversalProcPtr                entryPoint;                 /* to call back to HyperCard */
  126.     short                           request;
  127.     short                           result;
  128.     long                            inArgs[8];
  129.     long                            outArgs[4];
  130. };
  131. typedef struct XCmdBlock                XCmdBlock;
  132. typedef XCmdBlock *                     XCmdPtr;
  133. struct XWEventInfo {
  134.     EventRecord                     event;
  135.     WindowPtr                       eventWindow;
  136.     long                            eventParams[9];
  137.     Handle                          eventResult;
  138. };
  139. typedef struct XWEventInfo              XWEventInfo;
  140. typedef XWEventInfo *                   XWEventInfoPtr;
  141. struct XTalkObject {
  142.     short                           objectKind;                 /* stack, bkgnd, card, field, or button */
  143.     long                            stackNum;                   /* reference number of the source stack */
  144.     long                            bkgndID;
  145.     long                            cardID;
  146.     long                            buttonID;
  147.     long                            fieldID;
  148. };
  149. typedef struct XTalkObject              XTalkObject;
  150. typedef XTalkObject *                   XTalkObjectPtr;
  151. /* maximum number of checkpoints in a script */
  152. enum {
  153.     maxCachedChecks             = 16
  154. };
  155. struct CheckPts {
  156.     short                           checks[16];
  157. };
  158. typedef struct CheckPts                 CheckPts;
  159. typedef CheckPts *                      CheckPtPtr;
  160. typedef CheckPtPtr *                    CheckPtHandle;
  161. /*
  162.         HyperTalk Utilities  
  163. */
  164. #if CALL_NOT_IN_CARBON
  165. EXTERN_API( Handle )
  166. EvalExpr                        (XCmdPtr                paramPtr,
  167.                                  ConstStr255Param       expr);
  168. EXTERN_API( void )
  169. SendCardMessage                 (XCmdPtr                paramPtr,
  170.                                  ConstStr255Param       msg);
  171. EXTERN_API( void )
  172. SendHCMessage                   (XCmdPtr                paramPtr,
  173.                                  ConstStr255Param       msg);
  174. EXTERN_API( void )
  175. RunHandler                      (XCmdPtr                paramPtr,
  176.                                  Handle                 handler);
  177. /*
  178.         Memory Utilities  
  179. */
  180. EXTERN_API( Handle )
  181. GetGlobal                       (XCmdPtr                paramPtr,
  182.                                  ConstStr255Param       globName);
  183. EXTERN_API( void )
  184. SetGlobal                       (XCmdPtr                paramPtr,
  185.                                  ConstStr255Param       globName,
  186.                                  Handle                 globValue);
  187. EXTERN_API( void )
  188. ZeroBytes                       (XCmdPtr                paramPtr,
  189.                                  void *                 dstPtr,
  190.                                  long                   longCount);
  191. /*
  192.         String Utilities  
  193. */
  194. EXTERN_API( void )
  195. ScanToReturn                    (XCmdPtr                paramPtr,
  196.                                  Ptr *                  scanPtr);
  197. EXTERN_API( void )
  198. ScanToZero                      (XCmdPtr                paramPtr,
  199.                                  Ptr *                  scanPtr);
  200. EXTERN_API( Boolean )
  201. StringEqual                     (XCmdPtr                paramPtr,
  202.                                  ConstStr255Param       str1,
  203.                                  ConstStr255Param       str2);
  204. EXTERN_API( long )
  205. StringLength                    (XCmdPtr                paramPtr,
  206.                                  void *                 strPtr);
  207. EXTERN_API( void *)
  208. StringMatch                     (XCmdPtr                paramPtr,
  209.                                  ConstStr255Param       pattern,
  210.                                  void *                 target);
  211. EXTERN_API( void )
  212. ZeroTermHandle                  (XCmdPtr                paramPtr,
  213.                                  Handle                 hndl);
  214. /*
  215.         String Conversions  
  216. */
  217. EXTERN_API( void )
  218. BoolToStr                       (XCmdPtr                paramPtr,
  219.                                  Boolean                value,
  220.                                  Str255                 str);
  221. EXTERN_API( void )
  222. Double_tToStr                   (XCmdPtr                paramPtr,
  223.                                  double_t               num,
  224.                                  Str255                 str);
  225. EXTERN_API( void )
  226. LongToStr                       (XCmdPtr                paramPtr,
  227.                                  long                   posNum,
  228.                                  Str255                 str);
  229. EXTERN_API( void )
  230. NumToHex                        (XCmdPtr                paramPtr,
  231.                                  long                   num,
  232.                                  short                  nDigits,
  233.                                  Str255                 str);
  234. EXTERN_API( void )
  235. NumToStr                        (XCmdPtr                paramPtr,
  236.                                  long                   num,
  237.                                  Str255                 str);
  238. EXTERN_API( Handle )
  239. PasToZero                       (XCmdPtr                paramPtr,
  240.                                  ConstStr255Param       str);
  241. EXTERN_API( void )
  242. PointToStr                      (XCmdPtr                paramPtr,
  243.                                  Point                  pt,
  244.                                  Str255                 str);
  245. EXTERN_API( void )
  246. RectToStr                       (XCmdPtr                paramPtr,
  247.                                  const Rect *           rct,
  248.                                  Str255                 str);
  249. EXTERN_API( void )
  250. ReturnToPas                     (XCmdPtr                paramPtr,
  251.                                  void *                 zeroStr,
  252.                                  Str255                 pasStr);
  253. EXTERN_API( Boolean )
  254. StrToBool                       (XCmdPtr                paramPtr,
  255.                                  ConstStr255Param       str);
  256. EXTERN_API( double_t )
  257. StrToDouble_t                   (XCmdPtr                paramPtr,
  258.                                  ConstStr255Param       str);
  259. EXTERN_API( long )
  260. StrToLong                       (XCmdPtr                paramPtr,
  261.                                  ConstStr255Param       str);
  262. EXTERN_API( long )
  263. StrToNum                        (XCmdPtr                paramPtr,
  264.                                  ConstStr255Param       str);
  265. EXTERN_API( void )
  266. StrToPoint                      (XCmdPtr                paramPtr,
  267.                                  ConstStr255Param       str,
  268.                                  Point *                pt);
  269. EXTERN_API( void )
  270. StrToRect                       (XCmdPtr                paramPtr,
  271.                                  ConstStr255Param       str,
  272.                                  Rect *                 rct);
  273. EXTERN_API( void )
  274. ZeroToPas                       (XCmdPtr                paramPtr,
  275.                                  void *                 zeroStr,
  276.                                  Str255                 pasStr);
  277. /*
  278.         Field Utilities  
  279. */
  280. EXTERN_API( Handle )
  281. GetFieldByID                    (XCmdPtr                paramPtr,
  282.                                  Boolean                cardFieldFlag,
  283.                                  short                  fieldID);
  284. EXTERN_API( Handle )
  285. GetFieldByName                  (XCmdPtr                paramPtr,
  286.                                  Boolean                cardFieldFlag,
  287.                                  ConstStr255Param       fieldName);
  288. EXTERN_API( Handle )
  289. GetFieldByNum                   (XCmdPtr                paramPtr,
  290.                                  Boolean                cardFieldFlag,
  291.                                  short                  fieldNum);
  292. EXTERN_API( void )
  293. SetFieldByID                    (XCmdPtr                paramPtr,
  294.                                  Boolean                cardFieldFlag,
  295.                                  short                  fieldID,
  296.                                  Handle                 fieldVal);
  297. EXTERN_API( void )
  298. SetFieldByName                  (XCmdPtr                paramPtr,
  299.                                  Boolean                cardFieldFlag,
  300.                                  ConstStr255Param       fieldName,
  301.                                  Handle                 fieldVal);
  302. EXTERN_API( void )
  303. SetFieldByNum                   (XCmdPtr                paramPtr,
  304.                                  Boolean                cardFieldFlag,
  305.                                  short                  fieldNum,
  306.                                  Handle                 fieldVal);
  307. EXTERN_API( TEHandle )
  308. GetFieldTE                      (XCmdPtr                paramPtr,
  309.                                  Boolean                cardFieldFlag,
  310.                                  short                  fieldID,
  311.                                  short                  fieldNum,
  312.                                  ConstStr255Param       fieldName);
  313. EXTERN_API( void )
  314. SetFieldTE                      (XCmdPtr                paramPtr,
  315.                                  Boolean                cardFieldFlag,
  316.                                  short                  fieldID,
  317.                                  short                  fieldNum,
  318.                                  ConstStr255Param       fieldName,
  319.                                  TEHandle               fieldTE);
  320. /*
  321.         Miscellaneous Utilities  
  322. */
  323. EXTERN_API( void )
  324. BeginXSound                     (XCmdPtr                paramPtr,
  325.                                  WindowPtr              window);
  326. EXTERN_API( void )
  327. EndXSound                       (XCmdPtr                paramPtr);
  328. EXTERN_API( Boolean )
  329. GetFilePath                     (XCmdPtr                paramPtr,
  330.                                  ConstStr255Param       fileName,
  331.                                  short                  numTypes,
  332.                                  ConstSFTypeListPtr     typeList,
  333.                                  Boolean                askUser,
  334.                                  OSType *               fileType,
  335.                                  Str255                 fullName);
  336. EXTERN_API( void )
  337. GetXResInfo                     (XCmdPtr                paramPtr,
  338.                                  short *                resFile,
  339.                                  short *                resID,
  340.                                  ResType *              rType,
  341.                                  Str255                 name);
  342. EXTERN_API( void )
  343. Notify                          (XCmdPtr                paramPtr);
  344. EXTERN_API( void )
  345. SendHCEvent                     (XCmdPtr                paramPtr,
  346.                                  const EventRecord *    event);
  347. EXTERN_API( void )
  348. SendWindowMessage               (XCmdPtr                paramPtr,
  349.                                  WindowPtr              windPtr,
  350.                                  ConstStr255Param       windowName,
  351.                                  ConstStr255Param       msg);
  352. EXTERN_API( WindowPtr )
  353. FrontDocWindow                  (XCmdPtr                paramPtr);
  354. EXTERN_API( long )
  355. StackNameToNum                  (XCmdPtr                paramPtr,
  356.                                  ConstStr255Param       stackName);
  357. EXTERN_API( short )
  358. ShowHCAlert                     (XCmdPtr                paramPtr,
  359.                                  short                  dlgID,
  360.                                  ConstStr255Param       promptStr);
  361. EXTERN_API( Boolean )
  362. AbortInQueue                    (XCmdPtr                paramPtr);
  363. EXTERN_API( void )
  364. FlushStackFile                  (XCmdPtr                paramPtr);
  365. /*
  366.         Creating and Disposing XWindoids  
  367. */
  368. EXTERN_API( WindowPtr )
  369. NewXWindow                      (XCmdPtr                paramPtr,
  370.                                  const Rect *           boundsRect,
  371.                                  ConstStr255Param       title,
  372.                                  Boolean                visible,
  373.                                  short                  procID,
  374.                                  Boolean                color,
  375.                                  Boolean                floating);
  376. EXTERN_API( WindowPtr )
  377. GetNewXWindow                   (XCmdPtr                paramPtr,
  378.                                  ResType                templateType,
  379.                                  short                  templateID,
  380.                                  Boolean                color,
  381.                                  Boolean                floating);
  382. EXTERN_API( void )
  383. CloseXWindow                    (XCmdPtr                paramPtr,
  384.                                  WindowPtr              window);
  385. /*
  386.         XWindoid Utilities  
  387. */
  388. EXTERN_API( void )
  389. HideHCPalettes                  (XCmdPtr                paramPtr);
  390. EXTERN_API( void )
  391. ShowHCPalettes                  (XCmdPtr                paramPtr);
  392. EXTERN_API( void )
  393. RegisterXWMenu                  (XCmdPtr                paramPtr,
  394.                                  WindowPtr              window,
  395.                                  MenuHandle             menu,
  396.                                  Boolean                registering);
  397. EXTERN_API( void )
  398. SetXWIdleTime                   (XCmdPtr                paramPtr,
  399.                                  WindowPtr              window,
  400.                                  long                   interval);
  401. EXTERN_API( void )
  402. XWHasInterruptCode              (XCmdPtr                paramPtr,
  403.                                  WindowPtr              window,
  404.                                  Boolean                haveCode);
  405. EXTERN_API( void )
  406. XWAlwaysMoveHigh                (XCmdPtr                paramPtr,
  407.                                  WindowPtr              window,
  408.                                  Boolean                moveHigh);
  409. EXTERN_API( void )
  410. XWAllowReEntrancy               (XCmdPtr                paramPtr,
  411.                                  WindowPtr              window,
  412.                                  Boolean                allowSysEvts,
  413.                                  Boolean                allowHCEvts);
  414. /*
  415.         Text Editing Utilities  
  416. */
  417. EXTERN_API( void )
  418. BeginXWEdit                     (XCmdPtr                paramPtr,
  419.                                  WindowPtr              window);
  420. EXTERN_API( void )
  421. EndXWEdit                       (XCmdPtr                paramPtr,
  422.                                  WindowPtr              window);
  423. EXTERN_API( WordBreakUPP )
  424. HCWordBreakProc                 (XCmdPtr                paramPtr);
  425. EXTERN_API( void )
  426. PrintTEHandle                   (XCmdPtr                paramPtr,
  427.                                  TEHandle               hTE,
  428.                                  StringPtr              header);
  429. /*
  430.         Script Editor support  
  431. */
  432. EXTERN_API( CheckPtHandle )
  433. GetCheckPoints                  (XCmdPtr                paramPtr);
  434. EXTERN_API( void )
  435. SetCheckPoints                  (XCmdPtr                paramPtr,
  436.                                  CheckPtHandle          checkLines);
  437. EXTERN_API( void )
  438. FormatScript                    (XCmdPtr                paramPtr,
  439.                                  Handle                 scriptHndl,
  440.                                  long *                 insertionPoint,
  441.                                  Boolean                quickFormat);
  442. EXTERN_API( void )
  443. SaveXWScript                    (XCmdPtr                paramPtr,
  444.                                  Handle                 scriptHndl);
  445. EXTERN_API( void )
  446. GetObjectName                   (XCmdPtr                paramPtr,
  447.                                  XTalkObjectPtr         xObjPtr,
  448.                                  Str255                 objName);
  449. EXTERN_API( void )
  450. GetObjectScript                 (XCmdPtr                paramPtr,
  451.                                  XTalkObjectPtr         xObjPtr,
  452.                                  Handle *               scriptHndl);
  453. EXTERN_API( void )
  454. SetObjectScript                 (XCmdPtr                paramPtr,
  455.                                  XTalkObjectPtr         xObjPtr,
  456.                                  Handle                 scriptHndl);
  457. /*
  458.         Debugging Tools support  
  459. */
  460. EXTERN_API( void )
  461. AbortScript                     (XCmdPtr                paramPtr);
  462. EXTERN_API( void )
  463. GoScript                        (XCmdPtr                paramPtr);
  464. EXTERN_API( void )
  465. StepScript                      (XCmdPtr                paramPtr,
  466.                                  Boolean                stepInto);
  467. EXTERN_API( void )
  468. CountHandlers                   (XCmdPtr                paramPtr,
  469.                                  short *                handlerCount);
  470. EXTERN_API( void )
  471. GetHandlerInfo                  (XCmdPtr                paramPtr,
  472.                                  short                  handlerNum,
  473.                                  Str255                 handlerName,
  474.                                  Str255                 objectName,
  475.                                  short *                varCount);
  476. EXTERN_API( void )
  477. GetVarInfo                      (XCmdPtr                paramPtr,
  478.                                  short                  handlerNum,
  479.                                  short                  varNum,
  480.                                  Str255                 varName,
  481.                                  Boolean *              isGlobal,
  482.                                  Str255                 varValue,
  483.                                  Handle                 varHndl);
  484. EXTERN_API( void )
  485. SetVarValue                     (XCmdPtr                paramPtr,
  486.                                  short                  handlerNum,
  487.                                  short                  varNum,
  488.                                  Handle                 varHndl);
  489. EXTERN_API( Handle )
  490. GetStackCrawl                   (XCmdPtr                paramPtr);
  491. EXTERN_API( void )
  492. TraceScript                     (XCmdPtr                paramPtr,
  493.                                  Boolean                traceInto);
  494. #endif  /* CALL_NOT_IN_CARBON */
  495. #if PRAGMA_STRUCT_ALIGN
  496.     #pragma options align=reset
  497. #elif PRAGMA_STRUCT_PACKPUSH
  498.     #pragma pack(pop)
  499. #elif PRAGMA_STRUCT_PACK
  500.     #pragma pack()
  501. #endif
  502. #ifdef PRAGMA_IMPORT_OFF
  503. #pragma import off
  504. #elif PRAGMA_IMPORT
  505. #pragma import reset
  506. #endif
  507. #ifdef __cplusplus
  508. }
  509. #endif
  510. #endif /* __HYPERXCMD__ */