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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Dialogs.h
  3.  
  4.      Contains:   Dialog Manager interfaces.
  5.  
  6.      Version:    Technology: Mac OS 9
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1985-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 __DIALOGS__
  18. #define __DIALOGS__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #ifndef __EVENTS__
  26. #include "Events.h"
  27. #endif
  28. #ifndef __MACWINDOWS__
  29. #include "MacWindows.h"
  30. #endif
  31. #ifndef __TEXTEDIT__
  32. #include "TextEdit.h"
  33. #endif
  34. #ifndef __CONTROLS__
  35. #include "Controls.h"
  36. #endif
  37. #ifndef __MACERRORS__
  38. #include "MacErrors.h"
  39. #endif
  40. #if PRAGMA_ONCE
  41. #pragma once
  42. #endif
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. #if PRAGMA_IMPORT
  47. #pragma import on
  48. #endif
  49. #if PRAGMA_STRUCT_ALIGN
  50.     #pragma options align=mac68k
  51. #elif PRAGMA_STRUCT_PACKPUSH
  52.     #pragma pack(push, 2)
  53. #elif PRAGMA_STRUCT_PACK
  54.     #pragma pack(2)
  55. #endif
  56. enum {
  57.                                                                 /* new, more standard names for dialog item types*/
  58.     kControlDialogItem          = 4,
  59.     kButtonDialogItem           = kControlDialogItem | 0,
  60.     kCheckBoxDialogItem         = kControlDialogItem | 1,
  61.     kRadioButtonDialogItem      = kControlDialogItem | 2,
  62.     kResourceControlDialogItem  = kControlDialogItem | 3,
  63.     kStaticTextDialogItem       = 8,
  64.     kEditTextDialogItem         = 16,
  65.     kIconDialogItem             = 32,
  66.     kPictureDialogItem          = 64,
  67.     kUserDialogItem             = 0,
  68.     kItemDisableBit             = 128
  69. };
  70. enum {
  71.                                                                 /* old names for dialog item types*/
  72.     ctrlItem                    = 4,
  73.     btnCtrl                     = 0,
  74.     chkCtrl                     = 1,
  75.     radCtrl                     = 2,
  76.     resCtrl                     = 3,
  77.     statText                    = 8,
  78.     editText                    = 16,
  79.     iconItem                    = 32,
  80.     picItem                     = 64,
  81.     userItem                    = 0,
  82.     itemDisable                 = 128
  83. };
  84. enum {
  85.                                                                 /* standard dialog item numbers*/
  86.     kStdOkItemIndex             = 1,
  87.     kStdCancelItemIndex         = 2,                            /* old names*/
  88.     ok                          = kStdOkItemIndex,
  89.     cancel                      = kStdCancelItemIndex
  90. };
  91. enum {
  92.                                                                 /* standard icon resource id's    */
  93.     kStopIcon                   = 0,
  94.     kNoteIcon                   = 1,
  95.     kCautionIcon                = 2,                            /* old names*/
  96.     stopIcon                    = kStopIcon,
  97.     noteIcon                    = kNoteIcon,
  98.     cautionIcon                 = kCautionIcon
  99. };
  100. #if OLDROUTINENAMES
  101. /*
  102.    These constants lived briefly on ETO 16.  They suggest
  103.    that there is only one index you can use for the OK 
  104.    item, which is not true.  You can put the ok item 
  105.    anywhere you want in the DITL.
  106. */
  107. enum {
  108.     kOkItemIndex                = 1,
  109.     kCancelItemIndex            = 2
  110. };
  111. #endif  /* OLDROUTINENAMES */
  112. /*  Dialog Item List Manipulation Constants */
  113. typedef SInt16                          DITLMethod;
  114. enum {
  115.     overlayDITL                 = 0,
  116.     appendDITLRight             = 1,
  117.     appendDITLBottom            = 2
  118. };
  119. typedef SInt16                          StageList;
  120. /* DialogRef is obsolete. Use DialogPtr instead.*/
  121. typedef DialogPtr                       DialogRef;
  122. #if !OPAQUE_TOOLBOX_STRUCTS
  123. struct DialogRecord {
  124.     WindowRecord                    window;
  125.     Handle                          items;
  126.     TEHandle                        textH;
  127.     SInt16                          editField;
  128.     SInt16                          editOpen;
  129.     SInt16                          aDefItem;
  130. };
  131. typedef struct DialogRecord             DialogRecord;
  132. typedef DialogRecord *                  DialogPeek;
  133. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  134. struct DialogTemplate {
  135.     Rect                            boundsRect;
  136.     SInt16                          procID;
  137.     Boolean                         visible;
  138.     Boolean                         filler1;
  139.     Boolean                         goAwayFlag;
  140.     Boolean                         filler2;
  141.     SInt32                          refCon;
  142.     SInt16                          itemsID;
  143.     Str255                          title;
  144. };
  145. typedef struct DialogTemplate           DialogTemplate;
  146. typedef DialogTemplate *                DialogTPtr;
  147. typedef DialogTPtr *                    DialogTHndl;
  148. struct AlertTemplate {
  149.     Rect                            boundsRect;
  150.     SInt16                          itemsID;
  151.     StageList                       stages;
  152. };
  153. typedef struct AlertTemplate            AlertTemplate;
  154. typedef AlertTemplate *                 AlertTPtr;
  155. typedef AlertTPtr *                     AlertTHndl;
  156. /* new type abstractions for the dialog manager */
  157. typedef SInt16                          DialogItemIndexZeroBased;
  158. typedef SInt16                          DialogItemIndex;
  159. typedef SInt16                          DialogItemType;
  160. /* dialog manager callbacks */
  161. typedef CALLBACK_API( void , SoundProcPtr )(SInt16 soundNumber);
  162. typedef CALLBACK_API( Boolean , ModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, DialogItemIndex *itemHit);
  163. typedef CALLBACK_API( void , UserItemProcPtr )(DialogPtr theDialog, DialogItemIndex itemNo);
  164. typedef STACK_UPP_TYPE(SoundProcPtr)                            SoundUPP;
  165. typedef STACK_UPP_TYPE(ModalFilterProcPtr)                      ModalFilterUPP;
  166. typedef STACK_UPP_TYPE(UserItemProcPtr)                         UserItemUPP;
  167. #if OPAQUE_UPP_TYPES
  168. #if CALL_NOT_IN_CARBON
  169.     EXTERN_API(SoundUPP)
  170.     NewSoundUPP                    (SoundProcPtr            userRoutine);
  171. #endif  /* CALL_NOT_IN_CARBON */
  172.     EXTERN_API(ModalFilterUPP)
  173.     NewModalFilterUPP              (ModalFilterProcPtr      userRoutine);
  174.     EXTERN_API(UserItemUPP)
  175.     NewUserItemUPP                 (UserItemProcPtr         userRoutine);
  176. #if CALL_NOT_IN_CARBON
  177.     EXTERN_API(void)
  178.     DisposeSoundUPP                (SoundUPP                userUPP);
  179. #endif  /* CALL_NOT_IN_CARBON */
  180.     EXTERN_API(void)
  181.     DisposeModalFilterUPP          (ModalFilterUPP          userUPP);
  182.     EXTERN_API(void)
  183.     DisposeUserItemUPP             (UserItemUPP             userUPP);
  184. #if CALL_NOT_IN_CARBON
  185.     EXTERN_API(void)
  186.     InvokeSoundUPP                 (SInt16                  soundNumber,
  187.                                     SoundUPP                userUPP);
  188. #endif  /* CALL_NOT_IN_CARBON */
  189.     EXTERN_API(Boolean)
  190.     InvokeModalFilterUPP           (DialogPtr               theDialog,
  191.                                     EventRecord *           theEvent,
  192.                                     DialogItemIndex *       itemHit,
  193.                                     ModalFilterUPP          userUPP);
  194.     EXTERN_API(void)
  195.     InvokeUserItemUPP              (DialogPtr               theDialog,
  196.                                     DialogItemIndex         itemNo,
  197.                                     UserItemUPP             userUPP);
  198. #else
  199.     enum { uppSoundProcInfo = 0x00000080 };                         /* pascal no_return_value Func(2_bytes) */
  200.     enum { uppModalFilterProcInfo = 0x00000FD0 };                   /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  201.     enum { uppUserItemProcInfo = 0x000002C0 };                      /* pascal no_return_value Func(4_bytes, 2_bytes) */
  202.     #define NewSoundUPP(userRoutine)                                (SoundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundProcInfo, GetCurrentArchitecture())
  203.     #define NewModalFilterUPP(userRoutine)                          (ModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterProcInfo, GetCurrentArchitecture())
  204.     #define NewUserItemUPP(userRoutine)                             (UserItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserItemProcInfo, GetCurrentArchitecture())
  205.     #define DisposeSoundUPP(userUPP)                                DisposeRoutineDescriptor(userUPP)
  206.     #define DisposeModalFilterUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  207.     #define DisposeUserItemUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  208.     #define InvokeSoundUPP(soundNumber, userUPP)                    CALL_ONE_PARAMETER_UPP((userUPP), uppSoundProcInfo, (soundNumber))
  209.     #define InvokeModalFilterUPP(theDialog, theEvent, itemHit, userUPP)  (Boolean)CALL_THREE_PARAMETER_UPP((userUPP), uppModalFilterProcInfo, (theDialog), (theEvent), (itemHit))
  210.     #define InvokeUserItemUPP(theDialog, itemNo, userUPP)           CALL_TWO_PARAMETER_UPP((userUPP), uppUserItemProcInfo, (theDialog), (itemNo))
  211. #endif
  212. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  213. #define NewSoundProc(userRoutine)                               NewSoundUPP(userRoutine)
  214. #define NewModalFilterProc(userRoutine)                         NewModalFilterUPP(userRoutine)
  215. #define NewUserItemProc(userRoutine)                            NewUserItemUPP(userRoutine)
  216. #define CallSoundProc(userRoutine, soundNumber)                 InvokeSoundUPP(soundNumber, userRoutine)
  217. #define CallModalFilterProc(userRoutine, theDialog, theEvent, itemHit) InvokeModalFilterUPP(theDialog, theEvent, itemHit, userRoutine)
  218. #define CallUserItemProc(userRoutine, theDialog, itemNo)        InvokeUserItemUPP(theDialog, itemNo, userRoutine)
  219. #if !TARGET_OS_MAC
  220. /* QuickTime 3.0 */
  221. typedef CALLBACK_API_C( void , QTModelessCallbackProcPtr )(EventRecord *theEvent, DialogPtr theDialog, DialogItemIndex itemHit);
  222. #if CALL_NOT_IN_CARBON
  223. EXTERN_API( void )
  224. SetModelessDialogCallbackProc   (DialogPtr              theDialog,
  225.                                  QTModelessCallbackProcPtr  callbackProc);
  226. #endif  /* CALL_NOT_IN_CARBON */
  227. typedef QTModelessCallbackProcPtr       QTModelessCallbackUPP;
  228. #if CALL_NOT_IN_CARBON
  229. EXTERN_API( OSErr )
  230. GetDialogControlNotificationProc (void *                theProc);
  231. EXTERN_API( void )
  232. SetDialogMovableModal           (DialogPtr              theDialog);
  233. EXTERN_API( void *)
  234. GetDialogParent                 (DialogPtr              theDialog);
  235. #endif  /* CALL_NOT_IN_CARBON */
  236. #endif  /* !TARGET_OS_MAC */
  237. /*
  238.   ---------------------------------------------------------------------------------------------------------
  239.     o Following types are valid with Appearance 1.0 and later
  240.   ---------------------------------------------------------------------------------------------------------
  241. */
  242. enum {
  243.                                                                 /* Alert types to pass into StandardAlert */
  244.     kAlertStopAlert             = 0,
  245.     kAlertNoteAlert             = 1,
  246.     kAlertCautionAlert          = 2,
  247.     kAlertPlainAlert            = 3
  248. };
  249. typedef SInt16                          AlertType;
  250. enum {
  251.     kAlertDefaultOKText         = -1,                           /* "OK"*/
  252.     kAlertDefaultCancelText     = -1,                           /* "Cancel"*/
  253.     kAlertDefaultOtherText      = -1                            /* "Don't Save"*/
  254. };
  255. /* StandardAlert alert button numbers */
  256. enum {
  257.     kAlertStdAlertOKButton      = 1,
  258.     kAlertStdAlertCancelButton  = 2,
  259.     kAlertStdAlertOtherButton   = 3,
  260.     kAlertStdAlertHelpButton    = 4
  261. };
  262. enum {
  263.                                                                 /* Dialog Flags for use in NewFeaturesDialog or dlgx resource */
  264.     kDialogFlagsUseThemeBackground = (1 << 0),
  265.     kDialogFlagsUseControlHierarchy = (1 << 1),
  266.     kDialogFlagsHandleMovableModal = (1 << 2),
  267.     kDialogFlagsUseThemeControls = (1 << 3)
  268. };
  269. enum {
  270.                                                                 /* Alert Flags for use in alrx resource */
  271.     kAlertFlagsUseThemeBackground = (1 << 0),
  272.     kAlertFlagsUseControlHierarchy = (1 << 1),
  273.     kAlertFlagsAlertIsMovable   = (1 << 2),
  274.     kAlertFlagsUseThemeControls = (1 << 3)
  275. };
  276. /* For dftb resource */
  277. enum {
  278.     kDialogFontNoFontStyle      = 0,
  279.     kDialogFontUseFontMask      = 0x0001,
  280.     kDialogFontUseFaceMask      = 0x0002,
  281.     kDialogFontUseSizeMask      = 0x0004,
  282.     kDialogFontUseForeColorMask = 0x0008,
  283.     kDialogFontUseBackColorMask = 0x0010,
  284.     kDialogFontUseModeMask      = 0x0020,
  285.     kDialogFontUseJustMask      = 0x0040,
  286.     kDialogFontUseAllMask       = 0x00FF,
  287.     kDialogFontAddFontSizeMask  = 0x0100,
  288.     kDialogFontUseFontNameMask  = 0x0200,
  289.     kDialogFontAddToMetaFontMask = 0x0400
  290. };
  291. struct AlertStdAlertParamRec {
  292.     Boolean                         movable;                    /* Make alert movable modal */
  293.     Boolean                         helpButton;                 /* Is there a help button? */
  294.     ModalFilterUPP                  filterProc;                 /* Event filter */
  295.     ConstStringPtr                  defaultText;                /* Text for button in OK position */
  296.     ConstStringPtr                  cancelText;                 /* Text for button in cancel position */
  297.     ConstStringPtr                  otherText;                  /* Text for button in left position */
  298.     SInt16                          defaultButton;              /* Which button behaves as the default */
  299.     SInt16                          cancelButton;               /* Which one behaves as cancel (can be 0) */
  300.     UInt16                          position;                   /* Position (kWindowDefaultPosition in this case */
  301.                                                                 /* equals kWindowAlertPositionParentWindowScreen) */
  302. };
  303. typedef struct AlertStdAlertParamRec    AlertStdAlertParamRec;
  304. typedef AlertStdAlertParamRec *         AlertStdAlertParamPtr;
  305. /* --- end Appearance 1.0 or later stuff*/
  306. /*
  307.     NOTE: Code running under MultiFinder or System 7.0 or newer
  308.     should always pass NULL to InitDialogs.
  309. */
  310. #if CALL_NOT_IN_CARBON
  311. EXTERN_API( void )
  312. InitDialogs                     (void *                 ignored)                            ONEWORDINLINE(0xA97B);
  313. EXTERN_API( void )
  314. ErrorSound                      (SoundUPP               soundProc)                          ONEWORDINLINE(0xA98C);
  315. #endif  /* CALL_NOT_IN_CARBON */
  316. EXTERN_API( DialogPtr )
  317. NewDialog                       (void *                 dStorage,
  318.                                  const Rect *           boundsRect,
  319.                                  ConstStr255Param       title,
  320.                                  Boolean                visible,
  321.                                  SInt16                 procID,
  322.                                  WindowPtr              behind,
  323.                                  Boolean                goAwayFlag,
  324.                                  SInt32                 refCon,
  325.                                  Handle                 items)                              ONEWORDINLINE(0xA97D);
  326. EXTERN_API( DialogPtr )
  327. GetNewDialog                    (SInt16                 dialogID,
  328.                                  void *                 dStorage,
  329.                                  WindowPtr              behind)                             ONEWORDINLINE(0xA97C);
  330. EXTERN_API( DialogPtr )
  331. NewColorDialog                  (void *                 dStorage,
  332.                                  const Rect *           boundsRect,
  333.                                  ConstStr255Param       title,
  334.                                  Boolean                visible,
  335.                                  SInt16                 procID,
  336.                                  WindowPtr              behind,
  337.                                  Boolean                goAwayFlag,
  338.                                  SInt32                 refCon,
  339.                                  Handle                 items)                              ONEWORDINLINE(0xAA4B);
  340. #if CALL_NOT_IN_CARBON
  341. EXTERN_API( void )
  342. CloseDialog                     (DialogPtr              theDialog)                          ONEWORDINLINE(0xA982);
  343. #endif  /* CALL_NOT_IN_CARBON */
  344. EXTERN_API( void )
  345. DisposeDialog                   (DialogPtr              theDialog)                          ONEWORDINLINE(0xA983);
  346. EXTERN_API( void )
  347. ModalDialog                     (ModalFilterUPP         modalFilter,
  348.                                  DialogItemIndex *      itemHit)                            ONEWORDINLINE(0xA991);
  349. EXTERN_API( Boolean )
  350. IsDialogEvent                   (const EventRecord *    theEvent)                           ONEWORDINLINE(0xA97F);
  351. EXTERN_API( Boolean )
  352. DialogSelect                    (const EventRecord *    theEvent,
  353.                                  DialogPtr *            theDialog,
  354.                                  DialogItemIndex *      itemHit)                            ONEWORDINLINE(0xA980);
  355. EXTERN_API( void )
  356. DrawDialog                      (DialogPtr              theDialog)                          ONEWORDINLINE(0xA981);
  357. EXTERN_API( void )
  358. UpdateDialog                    (DialogPtr              theDialog,
  359.                                  RgnHandle              updateRgn)                          ONEWORDINLINE(0xA978);
  360. EXTERN_API( void )
  361. HideDialogItem                  (DialogPtr              theDialog,
  362.                                  DialogItemIndex        itemNo)                             ONEWORDINLINE(0xA827);
  363. EXTERN_API( void )
  364. ShowDialogItem                  (DialogPtr              theDialog,
  365.                                  DialogItemIndex        itemNo)                             ONEWORDINLINE(0xA828);
  366. EXTERN_API( DialogItemIndexZeroBased )
  367. FindDialogItem                  (DialogPtr              theDialog,
  368.                                  Point                  thePt)                              ONEWORDINLINE(0xA984);
  369. EXTERN_API( void )
  370. DialogCut                       (DialogPtr              theDialog);
  371. EXTERN_API( void )
  372. DialogPaste                     (DialogPtr              theDialog);
  373. EXTERN_API( void )
  374. DialogCopy                      (DialogPtr              theDialog);
  375. EXTERN_API( void )
  376. DialogDelete                    (DialogPtr              theDialog);
  377. EXTERN_API( DialogItemIndex )
  378. Alert                           (SInt16                 alertID,
  379.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA985);
  380. EXTERN_API( DialogItemIndex )
  381. StopAlert                       (SInt16                 alertID,
  382.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA986);
  383. EXTERN_API( DialogItemIndex )
  384. NoteAlert                       (SInt16                 alertID,
  385.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA987);
  386. EXTERN_API( DialogItemIndex )
  387. CautionAlert                    (SInt16                 alertID,
  388.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA988);
  389. EXTERN_API( void )
  390. GetDialogItem                   (DialogPtr              theDialog,
  391.                                  DialogItemIndex        itemNo,
  392.                                  DialogItemType *       itemType,
  393.                                  Handle *               item,
  394.                                  Rect *                 box)                                ONEWORDINLINE(0xA98D);
  395. EXTERN_API( void )
  396. SetDialogItem                   (DialogPtr              theDialog,
  397.                                  DialogItemIndex        itemNo,
  398.                                  DialogItemType         itemType,
  399.                                  Handle                 item,
  400.                                  const Rect *           box)                                ONEWORDINLINE(0xA98E);
  401. EXTERN_API( void )
  402. ParamText                       (ConstStr255Param       param0,
  403.                                  ConstStr255Param       param1,
  404.                                  ConstStr255Param       param2,
  405.                                  ConstStr255Param       param3)                             ONEWORDINLINE(0xA98B);
  406. EXTERN_API( void )
  407. SelectDialogItemText            (DialogPtr              theDialog,
  408.                                  DialogItemIndex        itemNo,
  409.                                  SInt16                 strtSel,
  410.                                  SInt16                 endSel)                             ONEWORDINLINE(0xA97E);
  411. EXTERN_API( void )
  412. GetDialogItemText               (Handle                 item,
  413.                                  Str255                 text)                               ONEWORDINLINE(0xA990);
  414. EXTERN_API( void )
  415. SetDialogItemText               (Handle                 item,
  416.                                  ConstStr255Param       text)                               ONEWORDINLINE(0xA98F);
  417. EXTERN_API( SInt16 )
  418. GetAlertStage                   (void)                                                      TWOWORDINLINE(0x3EB8, 0x0A9A);
  419. EXTERN_API( void )
  420. SetDialogFont                   (SInt16                 fontNum)                            TWOWORDINLINE(0x31DF, 0x0AFA);
  421. EXTERN_API( void )
  422. ResetAlertStage                 (void)                                                      TWOWORDINLINE(0x4278, 0x0A9A);
  423. /* APIs in Carbon*/
  424. EXTERN_API( void )
  425. GetParamText                    (StringPtr              param0,
  426.                                  StringPtr              param1,
  427.                                  StringPtr              param2,
  428.                                  StringPtr              param3);
  429. #if CALL_NOT_IN_CARBON
  430. EXTERN_API_C( DialogPtr )
  431. newdialog                       (void *                 dStorage,
  432.                                  const Rect *           boundsRect,
  433.                                  const char *           title,
  434.                                  Boolean                visible,
  435.                                  SInt16                 procID,
  436.                                  WindowPtr              behind,
  437.                                  Boolean                goAwayFlag,
  438.                                  SInt32                 refCon,
  439.                                  Handle                 items);
  440. EXTERN_API_C( DialogPtr )
  441. newcolordialog                  (void *                 dStorage,
  442.                                  const Rect *           boundsRect,
  443.                                  const char *           title,
  444.                                  Boolean                visible,
  445.                                  SInt16                 procID,
  446.                                  WindowPtr              behind,
  447.                                  Boolean                goAwayFlag,
  448.                                  SInt32                 refCon,
  449.                                  Handle                 items);
  450. EXTERN_API_C( void )
  451. paramtext                       (const char *           param0,
  452.                                  const char *           param1,
  453.                                  const char *           param2,
  454.                                  const char *           param3);
  455. EXTERN_API_C( void )
  456. getdialogitemtext               (Handle                 item,
  457.                                  char *                 text);
  458. EXTERN_API_C( void )
  459. setdialogitemtext               (Handle                 item,
  460.                                  const char *           text);
  461. EXTERN_API_C( DialogItemIndexZeroBased )
  462. finddialogitem                  (DialogPtr              theDialog,
  463.                                  Point *                thePt);
  464. #endif  /* CALL_NOT_IN_CARBON */
  465. EXTERN_API( void )
  466. AppendDITL                      (DialogPtr              theDialog,
  467.                                  Handle                 theHandle,
  468.                                  DITLMethod             method);
  469. EXTERN_API( DialogItemIndex )
  470. CountDITL                       (DialogPtr              theDialog);
  471. EXTERN_API( void )
  472. ShortenDITL                     (DialogPtr              theDialog,
  473.                                  DialogItemIndex        numberItems);
  474. EXTERN_API( OSStatus )
  475. InsertDialogItem                (DialogPtr              theDialog,
  476.                                  DialogItemIndex        afterItem,
  477.                                  DialogItemType         itemType,
  478.                                  Handle                 itemHandle,
  479.                                  const Rect *           box);
  480. EXTERN_API( OSStatus )
  481. RemoveDialogItems               (DialogPtr              theDialog,
  482.                                  DialogItemIndex        itemNo,
  483.                                  DialogItemIndex        amountToRemove,
  484.                                  Boolean                disposeItemData);
  485. EXTERN_API( Boolean )
  486. StdFilterProc                   (DialogPtr              theDialog,
  487.                                  EventRecord *          event,
  488.                                  DialogItemIndex *      itemHit);
  489. EXTERN_API( OSErr )
  490. GetStdFilterProc                (ModalFilterUPP *       theProc)                            THREEWORDINLINE(0x303C, 0x0203, 0xAA68);
  491. EXTERN_API( OSErr )
  492. SetDialogDefaultItem            (DialogPtr              theDialog,
  493.                                  DialogItemIndex        newItem)                            THREEWORDINLINE(0x303C, 0x0304, 0xAA68);
  494. EXTERN_API( OSErr )
  495. SetDialogCancelItem             (DialogPtr              theDialog,
  496.                                  DialogItemIndex        newItem)                            THREEWORDINLINE(0x303C, 0x0305, 0xAA68);
  497. EXTERN_API( OSErr )
  498. SetDialogTracksCursor           (DialogPtr              theDialog,
  499.                                  Boolean                tracks)                             THREEWORDINLINE(0x303C, 0x0306, 0xAA68);
  500. /*
  501.   ---------------------------------------------------------------------------------------------------------
  502.     o Appearance Dialog Routines (available only with Appearance 1.0 and later)
  503.   ---------------------------------------------------------------------------------------------------------
  504. */
  505. EXTERN_API( DialogPtr )
  506. NewFeaturesDialog               (void *                 inStorage,
  507.                                  const Rect *           inBoundsRect,
  508.                                  ConstStr255Param       inTitle,
  509.                                  Boolean                inIsVisible,
  510.                                  SInt16                 inProcID,
  511.                                  WindowPtr              inBehind,
  512.                                  Boolean                inGoAwayFlag,
  513.                                  SInt32                 inRefCon,
  514.                                  Handle                 inItemListHandle,
  515.                                  UInt32                 inFlags)                            THREEWORDINLINE(0x303C, 0x110C, 0xAA68);
  516. EXTERN_API( OSErr )
  517. AutoSizeDialog                  (DialogPtr              inDialog)                           THREEWORDINLINE(0x303C, 0x020D, 0xAA68);
  518. /*
  519.     Regarding StandardAlert and constness:
  520.     Even though the inAlertParam parameter is marked const here, there was
  521.     a chance Dialog Manager would modify it on versions of Mac OS prior to 9.
  522. */
  523. EXTERN_API( OSErr )
  524. StandardAlert                   (AlertType              inAlertType,
  525.                                  ConstStr255Param       inError,
  526.                                  ConstStr255Param       inExplanation,
  527.                                  const AlertStdAlertParamRec * inAlertParam,
  528.                                  SInt16 *               outItemHit)                         THREEWORDINLINE(0x303C, 0x090E, 0xAA68);
  529. EXTERN_API( OSErr )
  530. GetDialogItemAsControl          (DialogPtr              inDialog,
  531.                                  SInt16                 inItemNo,
  532.                                  ControlHandle *        outControl)                         THREEWORDINLINE(0x303C, 0x050F, 0xAA68);
  533. EXTERN_API( OSErr )
  534. MoveDialogItem                  (DialogPtr              inDialog,
  535.                                  SInt16                 inItemNo,
  536.                                  SInt16                 inHoriz,
  537.                                  SInt16                 inVert)                             THREEWORDINLINE(0x303C, 0x0510, 0xAA68);
  538. EXTERN_API( OSErr )
  539. SizeDialogItem                  (DialogPtr              inDialog,
  540.                                  SInt16                 inItemNo,
  541.                                  SInt16                 inWidth,
  542.                                  SInt16                 inHeight)                           THREEWORDINLINE(0x303C, 0x0511, 0xAA68);
  543. EXTERN_API( OSErr )
  544. AppendDialogItemList            (DialogPtr              dialog,
  545.                                  SInt16                 ditlID,
  546.                                  DITLMethod             method)                             THREEWORDINLINE(0x303C, 0x0412, 0xAA68);
  547. /*
  548.   ---------------------------------------------------------------------------------------------------------
  549.     o Dialog Routines available only with Appearance 1.1 and later
  550.   ---------------------------------------------------------------------------------------------------------
  551. */
  552. EXTERN_API( OSStatus )
  553. SetDialogTimeout                (DialogPtr              inDialog,
  554.                                  SInt16                 inButtonToPress,
  555.                                  UInt32                 inSecondsToWait);
  556. EXTERN_API( OSStatus )
  557. GetDialogTimeout                (DialogPtr              inDialog,
  558.                                  SInt16 *               outButtonToPress,
  559.                                  UInt32 *               outSecondsToWait,
  560.                                  UInt32 *               outSecondsRemaining);
  561. EXTERN_API( OSStatus )
  562. SetModalDialogEventMask         (DialogPtr              inDialog,
  563.                                  EventMask              inMask);
  564. EXTERN_API( OSStatus )
  565. GetModalDialogEventMask         (DialogPtr              inDialog,
  566.                                  EventMask *            outMask);
  567. #if OLDROUTINENAMES
  568. #define DisposDialog(theDialog) DisposeDialog(theDialog)
  569. #define UpdtDialog(theDialog, updateRgn) UpdateDialog(theDialog, updateRgn)
  570. #define GetDItem(theDialog, itemNo, itemType, item, box) GetDialogItem(theDialog, itemNo, itemType, item, box)
  571. #define SetDItem(theDialog, itemNo, itemType, item, box) SetDialogItem(theDialog, itemNo, itemType, item, box)
  572. #define HideDItem(theDialog, itemNo) HideDialogItem(theDialog, itemNo)
  573. #define ShowDItem(theDialog, itemNo) ShowDialogItem(theDialog, itemNo)
  574. #define SelIText(theDialog, itemNo, strtSel, endSel) SelectDialogItemText(theDialog, itemNo, strtSel, endSel)
  575. #define GetIText(item, text) GetDialogItemText(item, text)
  576. #define SetIText(item, text) SetDialogItemText(item, text)
  577. #define FindDItem(theDialog, thePt) FindDialogItem(theDialog, thePt)
  578. #define NewCDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) 
  579. NewColorDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  580. #define GetAlrtStage() GetAlertStage()
  581. #define ResetAlrtStage() ResetAlertStage()
  582. #define DlgCut(theDialog) DialogCut(theDialog)
  583. #define DlgPaste(theDialog) DialogPaste(theDialog)
  584. #define DlgCopy(theDialog) DialogCopy(theDialog)
  585. #define DlgDelete(theDialog) DialogDelete(theDialog)
  586. #define SetDAFont(fontNum) SetDialogFont(fontNum)
  587. #if CGLUESUPPORTED
  588. #define newcdialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) 
  589. newcolordialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  590. #define getitext(item, text) getdialogitemtext(item, text)
  591. #define setitext(item, text) setdialogitemtext(item, text)
  592. #define findditem(theDialog, thePt) finddialogitem(theDialog, thePt)
  593. #endif
  594. #endif  /* OLDROUTINENAMES */
  595. /*
  596.     *****************************************************************************
  597.     *                                                                           *
  598.     * The conditional STRICT_DIALOGS has been removed from this interface file. *
  599.     * The accessor macros to a DialogRecord are no longer necessary.            *
  600.     *                                                                           *
  601.     * All *Ref Types have reverted to their original Handle and Ptr Types.      *
  602.     *                                                                           *
  603.     *****************************************************************************
  604.     Details:
  605.     The original purpose of the STRICT_ conditionals and accessor macros was to
  606.     help ease the transition to Copland.  Shared data structures are difficult
  607.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  608.     WindowRecord and other data structures, we would begin the migration to the
  609.     discipline wherein system data structures are completely hidden from
  610.     applications.
  611.     
  612.     After many design reviews, we finally concluded that with this sort of
  613.     migration, the system could never tell when an application was no longer
  614.     peeking at a WindowRecord, and thus the data structure might never become
  615.     system owned.  Additionally, there were many other limitations in the
  616.     classic toolbox that were begging to be addressed.  The final decision was
  617.     to leave the traditional toolbox as a compatibility mode.
  618.     
  619.     We also decided to use the Handle and Ptr based types in the function
  620.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  621.     WindowRef.  The Ref types are still defined in the header files, so all
  622.     existing code will still compile exactly as it did before.  There are
  623.     several reasons why we chose to do this:
  624.     
  625.     - The importance of backwards compatibility makes it unfeasible for us to
  626.     enforce real opaque references in the implementation anytime in the
  627.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  628.     ControlRef, etc.) in the documentation and header files would always be a
  629.     fake veneer of opacity.
  630.     
  631.     - There exists a significant base of books and sample code that neophyte
  632.     Macintosh developers use to learn how to program the Macintosh.  These
  633.     books and sample code all use direct data access.  Introducing opaque data
  634.     types at this point would confuse neophyte programmers more than it would
  635.     help them.
  636.     
  637.     - Direct data structure access is used by nearly all Macintosh developers. 
  638.     Changing the interfaces to reflect a false opacity would not provide any
  639.     benefit to these developers.
  640.     
  641.     - Accessor functions are useful in and of themselves as convenience
  642.     functions, without being tied to opaque data types.  We will complete and
  643.     document the Windows and Dialogs accessor functions in an upcoming release
  644.     of the interfaces.
  645. */
  646. #if !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS
  647. #ifdef __cplusplus
  648. inline WindowPtr    GetDialogWindow(DialogPtr dialog)       { return (WindowPtr) dialog;                        }
  649. inline SInt16       GetDialogDefaultItem(DialogPtr dialog)  { return (*(SInt16 *) (((UInt8 *) dialog) + 168));  }
  650. inline SInt16       GetDialogCancelItem(DialogPtr dialog)   { return (*(SInt16 *) (((UInt8 *) dialog) + 166));  }
  651. inline SInt16       GetDialogKeyboardFocusItem(DialogPtr dialog)    { return (SInt16) ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1); }
  652. inline void     SetGrafPortOfDialog(DialogPtr dialog) { MacSetPort ((GrafPtr) dialog); }
  653. #else
  654. #define GetDialogWindow(dialog) ((WindowPtr) dialog)
  655. #define GetDialogDefaultItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 168))
  656. #define GetDialogCancelItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 166))
  657. #define GetDialogKeyboardFocusItem(dialog) ((SInt16)((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1))
  658. #define SetGrafPortOfDialog(dialog) do { MacSetPort ((GrafPtr) dialog); } while (false)
  659. #endif
  660. #endif  /* !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS */
  661. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  662. /* Getters */
  663. EXTERN_API( WindowPtr )
  664. GetDialogWindow                 (DialogPtr              dialog);
  665. EXTERN_API( TEHandle )
  666. GetDialogTextEditHandle         (DialogPtr              dialog);
  667. EXTERN_API( SInt16 )
  668. GetDialogDefaultItem            (DialogPtr              dialog);
  669. EXTERN_API( SInt16 )
  670. GetDialogCancelItem             (DialogPtr              dialog);
  671. EXTERN_API( SInt16 )
  672. GetDialogKeyboardFocusItem      (DialogPtr              dialog);
  673. /* Setters */
  674. /* Utilities */
  675. EXTERN_API( void )
  676. SetPortDialogPort               (DialogPtr              dialog);
  677. EXTERN_API( CGrafPtr )
  678. GetDialogPort                   (DialogPtr              dialog);
  679. /* To prevent upward dependencies, GetDialogFromWindow() is defined here instead of MacWindows.i */
  680. EXTERN_API( DialogPtr )
  681. GetDialogFromWindow             (WindowPtr              window);
  682. #endif  /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  683. #if CALL_NOT_IN_CARBON
  684. EXTERN_API( void )
  685. CouldDialog                     (SInt16                 dialogID)                           ONEWORDINLINE(0xA979);
  686. EXTERN_API( void )
  687. FreeDialog                      (SInt16                 dialogID)                           ONEWORDINLINE(0xA97A);
  688. EXTERN_API( void )
  689. CouldAlert                      (SInt16                 alertID)                            ONEWORDINLINE(0xA989);
  690. EXTERN_API( void )
  691. FreeAlert                       (SInt16                 alertID)                            ONEWORDINLINE(0xA98A);
  692. #endif  /* CALL_NOT_IN_CARBON */
  693. #if !TARGET_OS_MAC
  694. #endif  /* !TARGET_OS_MAC */
  695. #if PRAGMA_STRUCT_ALIGN
  696.     #pragma options align=reset
  697. #elif PRAGMA_STRUCT_PACKPUSH
  698.     #pragma pack(pop)
  699. #elif PRAGMA_STRUCT_PACK
  700.     #pragma pack()
  701. #endif
  702. #ifdef PRAGMA_IMPORT_OFF
  703. #pragma import off
  704. #elif PRAGMA_IMPORT
  705. #pragma import reset
  706. #endif
  707. #ifdef __cplusplus
  708. }
  709. #endif
  710. #endif /* __DIALOGS__ */