home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Controls.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  95.4 KB  |  2,332 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Controls.h
  3.  
  4.      Contains:    Control Manager interfaces
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 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 __CONTROLS__
  18. #define __CONTROLS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __QUICKDRAW__
  24. #include <Quickdraw.h>
  25. #endif
  26. #ifndef __MENUS__
  27. #include <Menus.h>
  28. #endif
  29. #ifndef __TEXTEDIT__
  30. #include <TextEdit.h>
  31. #endif
  32. #ifndef __DRAG__
  33. #include <Drag.h>
  34. #endif
  35. #ifndef __ICONS__
  36. #include <Icons.h>
  37. #endif
  38.  
  39.  
  40.  
  41. #if PRAGMA_ONCE
  42. #pragma once
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_STRUCT_ALIGN
  54.     #pragma options align=mac68k
  55. #elif PRAGMA_STRUCT_PACKPUSH
  56.     #pragma pack(push, 2)
  57. #elif PRAGMA_STRUCT_PACK
  58.     #pragma pack(2)
  59. #endif
  60.  
  61.  
  62. enum {
  63.     _ControlDispatch            = 0xAA73
  64. };
  65.  
  66. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  67. /*    • Gestalt                                                                                            */
  68. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  69.  
  70. enum {
  71.     gestaltControlMgrAttr        = FOUR_CHAR_CODE('cntl'),
  72.     gestaltControlMgrPresent    = (1L << 0)
  73. };
  74.  
  75. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  76. /*    • Resource Types                                                                                    */
  77. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  78.  
  79. enum {
  80.     kControlDefProcType            = FOUR_CHAR_CODE('CDEF'),
  81.     kControlTemplateResourceType = FOUR_CHAR_CODE('CNTL'),
  82.     kControlColorTableResourceType = FOUR_CHAR_CODE('cctb'),
  83.     kControlDefProcResourceType    = FOUR_CHAR_CODE('CDEF'),
  84.     kControlTabListResType        = FOUR_CHAR_CODE('tab#'),        /* used for tab control (Appearance 1.0 and later)*/
  85.     kControlListDescResType        = FOUR_CHAR_CODE('ldes')        /* used for list box control (Appearance 1.0 and later)*/
  86. };
  87.  
  88. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  89. /*    • Format of a ‘CNTL’ resource                                                                        */
  90. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  91.  
  92. struct ControlTemplate {
  93.     Rect                             controlRect;
  94.     SInt16                             controlValue;
  95.     Boolean                         controlVisible;
  96.     UInt8                             fill;
  97.     SInt16                             controlMaximum;
  98.     SInt16                             controlMinimum;
  99.     SInt16                             controlDefProcID;
  100.     SInt32                             controlReference;
  101.     Str255                             controlTitle;
  102. };
  103. typedef struct ControlTemplate            ControlTemplate;
  104. typedef ControlTemplate *                ControlTemplatePtr;
  105. typedef ControlTemplatePtr *            ControlTemplateHandle;
  106.  
  107.  
  108. #if !TARGET_OS_MAC
  109. /*
  110.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  111.    • NON-MAC COMPATIBILITY CODES (QuickTime 3.0)
  112.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  113. */
  114.  
  115. typedef UInt32                             ControlNotification;
  116.  
  117. enum {
  118.     controlNotifyNothing        = FOUR_CHAR_CODE('nada'),        /* No (null) notification*/
  119.     controlNotifyClick            = FOUR_CHAR_CODE('clik'),        /* Control was clicked*/
  120.     controlNotifyFocus            = FOUR_CHAR_CODE('focu'),        /* Control got keyboard focus*/
  121.     controlNotifyKey            = FOUR_CHAR_CODE('key ')        /* Control got a keypress*/
  122. };
  123.  
  124. typedef UInt32                             ControlCapabilities;
  125.  
  126. enum {
  127.     kControlCanAutoInvalidate    = 1L << 0                        /* Control component automatically invalidates areas left behind after hide/move operation.*/
  128. };
  129.  
  130. /* procID's for our added "controls"*/
  131.  
  132. enum {
  133.     staticTextProc                = 256,                            /* static text*/
  134.     editTextProc                = 272,                            /* editable text*/
  135.     iconProc                    = 288,                            /* icon*/
  136.     userItemProc                = 304,                            /* user drawn item*/
  137.     pictItemProc                = 320                            /* pict*/
  138. };
  139.  
  140. #endif  /* !TARGET_OS_MAC */
  141.  
  142. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  143. /*    • ControlHandle                                                                                        */
  144. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  145. typedef struct ControlRecord             ControlRecord;
  146. typedef ControlRecord *                    ControlPtr;
  147. typedef ControlPtr *                    ControlHandle;
  148. /* ControlRef is obsolete. Use ControlHandle.*/
  149. typedef ControlHandle                     ControlRef;
  150. typedef SInt16                             ControlPartCode;
  151. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  152. /* • Control ActionProcPtr                                                                                */
  153. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  154. typedef CALLBACK_API( void , ControlActionProcPtr )(ControlHandle theControl, ControlPartCode partCode);
  155. typedef STACK_UPP_TYPE(ControlActionProcPtr)                     ControlActionUPP;
  156. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  157. /*    • ControlRecord                                                                                        */
  158. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  159.  
  160. struct ControlRecord {
  161.     ControlHandle                     nextControl;
  162.     WindowPtr                         contrlOwner;
  163.     Rect                             contrlRect;
  164.     UInt8                             contrlVis;
  165.     UInt8                             contrlHilite;
  166.     SInt16                             contrlValue;
  167.     SInt16                             contrlMin;
  168.     SInt16                             contrlMax;
  169.     Handle                             contrlDefProc;
  170.     Handle                             contrlData;
  171.     ControlActionUPP                 contrlAction;
  172.     SInt32                             contrlRfCon;
  173.     Str255                             contrlTitle;
  174. };
  175.  
  176. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  177. /* • Control ActionProcPtr : Epilogue                                                                    */
  178. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  179. enum { uppControlActionProcInfo = 0x000002C0 };                 /* pascal no_return_value Func(4_bytes, 2_bytes) */
  180. #define NewControlActionProc(userRoutine)                         (ControlActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlActionProcInfo, GetCurrentArchitecture())
  181. #define CallControlActionProc(userRoutine, theControl, partCode)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlActionProcInfo, (theControl), (partCode))
  182. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  183. /*    • Control Color Table                                                                                */
  184. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  185.  
  186. enum {
  187.     cFrameColor                    = 0,
  188.     cBodyColor                    = 1,
  189.     cTextColor                    = 2,
  190.     cThumbColor                    = 3,
  191.     kNumberCtlCTabEntries        = 4
  192. };
  193.  
  194.  
  195. struct CtlCTab {
  196.     SInt32                             ccSeed;
  197.     SInt16                             ccRider;
  198.     SInt16                             ctSize;
  199.     ColorSpec                         ctTable[4];
  200. };
  201. typedef struct CtlCTab                    CtlCTab;
  202.  
  203. typedef CtlCTab *                        CCTabPtr;
  204. typedef CCTabPtr *                        CCTabHandle;
  205. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  206. /*    • Auxiliary Control Record                                                                            */
  207. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  208.  
  209. struct AuxCtlRec {
  210.     Handle                             acNext;
  211.     ControlHandle                     acOwner;
  212.     CCTabHandle                     acCTable;
  213.     SInt16                             acFlags;
  214.     SInt32                             acReserved;
  215.     SInt32                             acRefCon;
  216. };
  217. typedef struct AuxCtlRec                AuxCtlRec;
  218.  
  219. typedef AuxCtlRec *                        AuxCtlPtr;
  220. typedef AuxCtlPtr *                        AuxCtlHandle;
  221. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  222. /*    • PopUp Menu Private Data Structure                                                                    */
  223. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  224.  
  225. struct PopupPrivateData {
  226.     MenuHandle                         mHandle;
  227.     SInt16                             mID;
  228. };
  229. typedef struct PopupPrivateData            PopupPrivateData;
  230. typedef PopupPrivateData *                PopupPrivateDataPtr;
  231. typedef PopupPrivateDataPtr *            PopupPrivateDataHandle;
  232.  
  233. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  234. /*    • Errors are in the range -30580 .. -30599                                                            */
  235. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  236.  
  237. enum {
  238.     errMessageNotSupported        = -30580,
  239.     errDataNotSupported            = -30581,
  240.     errControlDoesntSupportFocus = -30582,
  241.     errWindowDoesntSupportFocus    = -30583,
  242.     errUnknownControl            = -30584,
  243.     errCouldntSetFocus            = -30585,
  244.     errNoRootControl            = -30586,
  245.     errRootAlreadyExists        = -30587,
  246.     errInvalidPartCode            = -30588,
  247.     errControlsAlreadyExist        = -30589,
  248.     errControlIsNotEmbedder        = -30590,
  249.     errDataSizeMismatch            = -30591,
  250.     errControlHiddenOrDisabled    = -30592,
  251.     errWindowRegionCodeInvalid    = -30593,
  252.     errCantEmbedIntoSelf        = -30594,
  253.     errCantEmbedRoot            = -30595,
  254.     errItemNotControl            = -30596,
  255.     controlInvalidDataVersionErr = -30597,
  256.     controlPropertyInvalid        = -5603,
  257.     controlPropertyNotFoundErr    = -5604,
  258.     controlHandleInvalidErr        = -30599
  259. };
  260.  
  261. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  262. /*    • Control Definition ID’s                                                                            */
  263. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  264. /* Standard System 7 procIDs*/
  265.  
  266.  
  267. enum {
  268.     pushButProc                    = 0,
  269.     checkBoxProc                = 1,
  270.     radioButProc                = 2,
  271.     scrollBarProc                = 16,
  272.     popupMenuProc                = 1008
  273. };
  274.  
  275.  
  276. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  277. /*    • Control Types and ID’s available only with Appearance 1.0 and later                                */
  278. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  279.  
  280.  
  281. enum {
  282.     kControlSupportsNewMessages    = FOUR_CHAR_CODE(' ok ')        /* CDEF should return as result of kControlMsgTestNewMsgSupport*/
  283. };
  284.  
  285. /* focusing part codes */
  286.  
  287. enum {
  288.     kControlFocusNoPart            = 0,                            /* tells control to clear its focus*/
  289.     kControlFocusNextPart        = -1,                            /* tells control to focus on the next part*/
  290.     kControlFocusPrevPart        = -2                            /* tells control to focus on the previous part*/
  291. };
  292.  
  293.  
  294. typedef SInt16                             ControlFocusPart;
  295. /* Use this constant in Get/SetControlData when the data referred to is not            */
  296. /* specific to a part, but rather the entire control, e.g. the list handle of a     */
  297. /* list box control.                                                                */
  298.  
  299. enum {
  300.     kControlEntireControl        = 0
  301. };
  302.  
  303. /* Key Filter result codes                                                             */
  304. /*                                                                                    */
  305. /* Certain controls can have a keyfilter attached to them. The filter proc should    */
  306. /* return one of the two constants below. If kKeyFilterBlockKey is returned, the    */
  307. /* key is blocked and never makes it to the control. If kKeyFilterPassKey is        */
  308. /* returned, the control receives the keystroke.                                    */
  309.  
  310. enum {
  311.     kControlKeyFilterBlockKey    = 0,
  312.     kControlKeyFilterPassKey    = 1
  313. };
  314.  
  315. typedef SInt16                             ControlKeyFilterResult;
  316. /* ControlKeyScriptBehavior                                                            */
  317. /*                                                                                    */
  318. /* These are the values you can use with kControlEditTextKeyScriptBehaviorTag on an */
  319. /* Edit Text control.                                                                */
  320. /* The default for password fields is kControlKeyScriptBehaviorPrefersRoman, while    */
  321. /* non password fields default to kControlKeyScriptBehaviorAllowAnyScript.            */
  322.  
  323. enum {
  324.     kControlKeyScriptBehaviorAllowAnyScript = FOUR_CHAR_CODE('any '), /* leaves the current keyboard alone and allows user to change the keyboard.*/
  325.     kControlKeyScriptBehaviorPrefersRoman = FOUR_CHAR_CODE('prmn'), /* switches the keyboard to roman, but allows them to change it as desired.*/
  326.     kControlKeyScriptBehaviorRequiresRoman = FOUR_CHAR_CODE('rrmn') /* switches the keyboard to roman and prevents the user from changing it.*/
  327. };
  328.  
  329. typedef UInt32                             ControlKeyScriptBehavior;
  330. /*——————————————————————————————————————————————————————————————————————————————————————*/
  331. /*     SPECIAL FONT USAGE NOTES: You can specify the font to use for many control types.
  332.     The constants below are meta-font numbers which you can use to set a particular
  333.     control's font usage. There are essentially two modes you can use: 1) default,
  334.     which is essentially the same as it always has been, i.e. it uses the system font, unless
  335.     directed to use the window font via a control variant. 2) you can specify to use
  336.     the big or small system font in a generic manner. The Big system font is the font
  337.     used in menus, etc. Chicago has filled that role for some time now. Small system
  338.     font is currently Geneva 10. The meta-font number implies the size and style.
  339.  
  340.     NOTE:        Not all font attributes are used by all controls. Most, in fact, ignore
  341.                 the fore and back color (Static Text is the only one that does, for
  342.                 backwards compatibility). Also size, face, and addFontSize are ignored
  343.                 when using the meta-font numbering.
  344. */
  345. /*——————————————————————————————————————————————————————————————————————————————————————*/
  346.  
  347. enum {
  348.                                                                 /* Meta-font numbering - see not above */
  349.     kControlFontBigSystemFont    = -1,                            /* force to big system font*/
  350.     kControlFontSmallSystemFont    = -2,                            /* force to small system font*/
  351.     kControlFontSmallBoldSystemFont = -3                        /* force to small bold system font*/
  352. };
  353.  
  354. /* Add these masks together to set the flags field of a ControlFontStyleRec    */
  355. /* They specify which fields to apply to the text. It is important to make    */
  356. /* sure that you specify only the fields that you wish to set.                */
  357.  
  358. enum {
  359.     kControlUseFontMask            = 0x0001,
  360.     kControlUseFaceMask            = 0x0002,
  361.     kControlUseSizeMask            = 0x0004,
  362.     kControlUseForeColorMask    = 0x0008,
  363.     kControlUseBackColorMask    = 0x0010,
  364.     kControlUseModeMask            = 0x0020,
  365.     kControlUseJustMask            = 0x0040,
  366.     kControlUseAllMask            = 0x00FF,
  367.     kControlAddFontSizeMask        = 0x0100
  368. };
  369.  
  370. /* flags available in Appearance 1.1 or later */
  371. /* AddToMetaFont indicates that we want to start with a standard system        */
  372. /* font, but then we'd like to add the other attributes. Normally, the meta    */
  373. /* font ignores all other flags                                             */
  374.  
  375. enum {
  376.     kControlAddToMetaFontMask    = 0x0200
  377. };
  378.  
  379.  
  380. struct ControlFontStyleRec {
  381.     SInt16                             flags;
  382.     SInt16                             font;
  383.     SInt16                             size;
  384.     SInt16                             style;
  385.     SInt16                             mode;
  386.     SInt16                             just;
  387.     RGBColor                         foreColor;
  388.     RGBColor                         backColor;
  389. };
  390. typedef struct ControlFontStyleRec        ControlFontStyleRec;
  391.  
  392. typedef ControlFontStyleRec *            ControlFontStylePtr;
  393. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  394. /*    • Common data tags for Get/SetControlData                                                            */
  395. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  396.  
  397. enum {
  398.     kControlFontStyleTag        = FOUR_CHAR_CODE('font'),
  399.     kControlKeyFilterTag        = FOUR_CHAR_CODE('fltr')
  400. };
  401.  
  402.  
  403. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  404. /*    • Control Feature Bits                                                                                */
  405. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  406.  
  407. enum {
  408.                                                                 /* Control feature bits - returned by GetControlFeatures */
  409.     kControlSupportsGhosting    = 1 << 0,
  410.     kControlSupportsEmbedding    = 1 << 1,
  411.     kControlSupportsFocus        = 1 << 2,
  412.     kControlWantsIdle            = 1 << 3,
  413.     kControlWantsActivate        = 1 << 4,
  414.     kControlHandlesTracking        = 1 << 5,
  415.     kControlSupportsDataAccess    = 1 << 6,
  416.     kControlHasSpecialBackground = 1 << 7,
  417.     kControlGetsFocusOnClick    = 1 << 8,
  418.     kControlSupportsCalcBestRect = 1 << 9,
  419.     kControlSupportsLiveFeedback = 1 << 10
  420. };
  421.  
  422. /* Features introduced in Appearance 1.0.1 */
  423.  
  424. enum {
  425.     kControlHasRadioBehavior    = 1 << 11
  426. };
  427.  
  428. /* Features introduced in Appearance 1.1 */
  429.  
  430. enum {
  431.     kControlAutoToggles            = 1 << 14,
  432.     kControlSupportsGetRegion    = 1 << 17
  433. };
  434.  
  435. /* Control Messages */
  436.  
  437. enum {
  438.     kControlMsgDrawGhost        = 13,
  439.     kControlMsgCalcBestRect        = 14,                            /* Calculate best fitting rectangle for control*/
  440.     kControlMsgHandleTracking    = 15,
  441.     kControlMsgFocus            = 16,                            /* param indicates action.*/
  442.     kControlMsgKeyDown            = 17,
  443.     kControlMsgIdle                = 18,
  444.     kControlMsgGetFeatures        = 19,
  445.     kControlMsgSetData            = 20,
  446.     kControlMsgGetData            = 21,
  447.     kControlMsgActivate            = 22,
  448.     kControlMsgSetUpBackground    = 23,
  449.     kControlMsgCalcValueFromPos    = 26,
  450.     kControlMsgTestNewMsgSupport = 27                            /* See if this control supports new messaging*/
  451. };
  452.  
  453. /* Messages in Appearance 1.0.1 or later*/
  454.  
  455. enum {
  456.     kControlMsgSubValueChanged    = 25,
  457.     kControlMsgSubControlAdded    = 28,
  458.     kControlMsgSubControlRemoved = 29
  459. };
  460.  
  461. /* Messages in Appearance 1.1 or later */
  462.  
  463. enum {
  464.     kControlMsgApplyTextColor    = 30,
  465.     kControlMsgGetRegion        = 31
  466. };
  467.  
  468. /*——————————————————————————————————————————————————————————————————————————————————————*/
  469. /*     This structure is passed into a CDEF when called with the kControlMsgHandleTracking    */
  470. /*    message                                                                             */
  471. /*——————————————————————————————————————————————————————————————————————————————————————*/
  472.  
  473. struct ControlTrackingRec {
  474.     Point                             startPt;
  475.     SInt16                             modifiers;
  476.     ControlActionUPP                 action;
  477. };
  478. typedef struct ControlTrackingRec        ControlTrackingRec;
  479.  
  480. typedef ControlTrackingRec *            ControlTrackingPtr;
  481. /*——————————————————————————————————————————————————————————————————————————————————————*/
  482. /* This structure is passed into a CDEF when called with the kControlMsgKeyDown message */
  483. /*——————————————————————————————————————————————————————————————————————————————————————*/
  484.  
  485. struct ControlKeyDownRec {
  486.     SInt16                             modifiers;
  487.     SInt16                             keyCode;
  488.     SInt16                             charCode;
  489. };
  490. typedef struct ControlKeyDownRec        ControlKeyDownRec;
  491.  
  492. typedef ControlKeyDownRec *                ControlKeyDownPtr;
  493. /*——————————————————————————————————————————————————————————————————————————————————————*/
  494. /* This structure is passed into a CDEF when called with the kControlMsgGetData or        */
  495. /* kControlMsgSetData message                                                             */
  496. /*——————————————————————————————————————————————————————————————————————————————————————*/
  497.  
  498. struct ControlDataAccessRec {
  499.     ResType                         tag;
  500.     ResType                         part;
  501.     Size                             size;
  502.     Ptr                             dataPtr;
  503. };
  504. typedef struct ControlDataAccessRec        ControlDataAccessRec;
  505.  
  506. typedef ControlDataAccessRec *            ControlDataAccessPtr;
  507. /*——————————————————————————————————————————————————————————————————————————————————————*/
  508. /* This structure is passed into a CDEF when called with the kControlCalcBestRect msg     */
  509. /*——————————————————————————————————————————————————————————————————————————————————————*/
  510.  
  511. struct ControlCalcSizeRec {
  512.     SInt16                             height;
  513.     SInt16                             width;
  514.     SInt16                             baseLine;
  515. };
  516. typedef struct ControlCalcSizeRec        ControlCalcSizeRec;
  517.  
  518. typedef ControlCalcSizeRec *            ControlCalcSizePtr;
  519. /*——————————————————————————————————————————————————————————————————————————————————————*/
  520. /* This structure is passed into a CDEF when called with the kControlMsgSetUpBackground */
  521. /* message is sent                                                                        */
  522. /*——————————————————————————————————————————————————————————————————————————————————————*/
  523.  
  524. struct ControlBackgroundRec {
  525.     SInt16                             depth;
  526.     Boolean                         colorDevice;
  527. };
  528. typedef struct ControlBackgroundRec        ControlBackgroundRec;
  529.  
  530. typedef ControlBackgroundRec *            ControlBackgroundPtr;
  531. /*——————————————————————————————————————————————————————————————————————————————————————*/
  532. /* This structure is passed into a CDEF when called with the kControlMsgApplyTextColor    */
  533. /* message is sent                                                                        */
  534. /*——————————————————————————————————————————————————————————————————————————————————————*/
  535.  
  536. struct ControlApplyTextColorRec {
  537.     SInt16                             depth;
  538.     Boolean                         colorDevice;
  539.     Boolean                         active;
  540. };
  541. typedef struct ControlApplyTextColorRec    ControlApplyTextColorRec;
  542.  
  543. typedef ControlApplyTextColorRec *        ControlApplyTextColorPtr;
  544. /*——————————————————————————————————————————————————————————————————————————————————————*/
  545. /* This structure is passed into a CDEF when called with the kControlMsgGetRegion        */
  546. /* message is sent                                                                        */
  547. /*——————————————————————————————————————————————————————————————————————————————————————*/
  548.  
  549. struct ControlGetRegionRec {
  550.     RgnHandle                         region;
  551.     ControlPartCode                 part;
  552. };
  553. typedef struct ControlGetRegionRec        ControlGetRegionRec;
  554.  
  555. typedef ControlGetRegionRec *            ControlGetRegionPtr;
  556. /*——————————————————————————————————————————————————————————————————————————————————————*/
  557. /*    Key Filter                                                                            */
  558. /*                                                                                        */
  559. /* Definition of a key filter for intercepting and possibly changing keystrokes            */
  560. /* which are destined for a control                                                        */
  561. /*——————————————————————————————————————————————————————————————————————————————————————*/
  562. typedef CALLBACK_API( ControlKeyFilterResult , ControlKeyFilterProcPtr )(ControlHandle theControl, SInt16 *keyCode, SInt16 *charCode, SInt16 *modifiers);
  563. typedef STACK_UPP_TYPE(ControlKeyFilterProcPtr)                 ControlKeyFilterUPP;
  564. enum { uppControlKeyFilterProcInfo = 0x00003FE0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  565. #define NewControlKeyFilterProc(userRoutine)                     (ControlKeyFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlKeyFilterProcInfo, GetCurrentArchitecture())
  566. #define CallControlKeyFilterProc(userRoutine, theControl, keyCode, charCode, modifiers)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlKeyFilterProcInfo, (theControl), (keyCode), (charCode), (modifiers))
  567. /*——————————————————————————————————————————————————————————————————————————————————————*/
  568. /*    • BEVEL BUTTON INTERFACE (CDEF 2)                                                    */
  569. /*——————————————————————————————————————————————————————————————————————————————————————*/
  570. /*    Bevel buttons allow you to control the content type (pict/icon/etc.), the behavior    */
  571. /* (pushbutton/toggle/sticky), and the bevel size. You also have the option of            */
  572. /*    attaching a menu to it. When a menu is present, you can specify which way the         */
  573. /*    popup arrow is facing (down or right).                                                */
  574. /*                                                                                        */
  575. /*    This is all made possible by overloading the Min, Max, and Value parameters for the    */
  576. /*    control, as well as adjusting the variant. Here's the breakdown of what goes where:    */
  577. /*                                                                                        */
  578. /*    Parameter                    What Goes Here                                            */
  579. /*    ———————————————————            ————————————————————————————————————————————————————    */
  580. /*    Min                            Hi Byte = Behavior, Lo Byte = content type.                */
  581. /*    Max                            ResID for resource-based content types.                    */
  582. /*    Value                        MenuID to attach, 0 = no menu, please.                    */
  583. /*                                                                                        */
  584. /*    The variant is broken down into two halfs. The low 2 bits control the bevel type.    */
  585. /*    Bit 2 controls the popup arrow direction (if a menu is present) and bit 3 controls    */
  586. /*    whether or not to use the control's owning window's font.                            */
  587. /*                                                                                        */
  588. /*    Constants for all you need to put this together are below. The values for behaviors    */
  589. /*    are set up so that you can simply add them to the content type and pass them into    */
  590. /*    the Min parameter of NewControl.                                                    */
  591. /*                                                                                        */
  592. /*    An example call:                                                                    */
  593. /*                                                                                        */
  594. /*    control = NewControl( window, &bounds, "\p", true, 0, kContentIconSuiteRes +         */
  595. /*                            kBehaviorToggles, myIconSuiteID, bevelButtonSmallBevelProc,    */
  596. /*                            0L );                                                        */
  597. /*                                                                                        */
  598. /*    Attaching a menu:                                                                    */
  599. /*                                                                                        */
  600. /*    control = NewControl( window, &bounds, "\p", true, kMyMenuID, kContentIconSuiteRes,    */
  601. /*            myIconSuiteID, bevelButtonSmallBevelProc + kBevelButtonMenuOnRight, 0L );    */
  602. /*                                                                                        */
  603. /*    This will attach menu ID kMyMenuID to the button, with the popup arrow facing right.*/
  604. /*    This also puts the menu up to the right of the button. You can also specify that a    */
  605. /*    menu can have multiple items checked at once by adding kBehaviorMultiValueMenus        */
  606. /*    into the Min parameter. If you do use multivalue menus, the GetBevelButtonMenuValue    */
  607. /*    helper function will return the last item chosen from the menu, whether or not it    */
  608. /*    was checked.                                                                        */
  609. /*                                                                                        */
  610. /*    NOTE:     Bevel buttons with menus actually have *two* values. The value of the         */
  611. /*            button (on/off), and the value of the menu. The menu value can be gotten    */
  612. /*            with the GetBevelButtonMenuValue helper function.                            */
  613. /*                                                                                        */
  614. /*    Handle-based Content                                                                */
  615. /*    ————————————————————                                                                */
  616. /*    You can create your control and then set the content to an existing handle to an    */
  617. /*    icon suite, etc. using the macros below. Please keep in mind that resource-based    */
  618. /*    content is owned by the control, handle-based content is owned by you. The CDEF will*/
  619. /*    not try to dispose of handle-based content. If you are changing the content type of    */
  620. /*    the button on the fly, you must make sure that if you are replacing a handle-        */
  621. /*    based content with a resource-based content to properly dispose of the handle,        */
  622. /*    else a memory leak will ensue.                                                        */
  623. /*                                                                                        */
  624.  
  625. enum {
  626.                                                                 /* Bevel Button Proc IDs */
  627.     kControlBevelButtonSmallBevelProc = 32,
  628.     kControlBevelButtonNormalBevelProc = 33,
  629.     kControlBevelButtonLargeBevelProc = 34
  630. };
  631.  
  632.  
  633. enum {
  634.                                                                 /* Bevel button graphic alignment values */
  635.     kControlBevelButtonAlignSysDirection = -1,                    /* only left or right*/
  636.     kControlBevelButtonAlignCenter = 0,
  637.     kControlBevelButtonAlignLeft = 1,
  638.     kControlBevelButtonAlignRight = 2,
  639.     kControlBevelButtonAlignTop    = 3,
  640.     kControlBevelButtonAlignBottom = 4,
  641.     kControlBevelButtonAlignTopLeft = 5,
  642.     kControlBevelButtonAlignBottomLeft = 6,
  643.     kControlBevelButtonAlignTopRight = 7,
  644.     kControlBevelButtonAlignBottomRight = 8
  645. };
  646.  
  647. typedef SInt16                             ControlButtonGraphicAlignment;
  648.  
  649. enum {
  650.                                                                 /* Bevel button text alignment values */
  651.     kControlBevelButtonAlignTextSysDirection = teFlushDefault,
  652.     kControlBevelButtonAlignTextCenter = teCenter,
  653.     kControlBevelButtonAlignTextFlushRight = teFlushRight,
  654.     kControlBevelButtonAlignTextFlushLeft = teFlushLeft
  655. };
  656.  
  657. typedef SInt16                             ControlButtonTextAlignment;
  658.  
  659. enum {
  660.                                                                 /* Bevel button text placement values */
  661.     kControlBevelButtonPlaceSysDirection = -1,                    /* if graphic on right, then on left*/
  662.     kControlBevelButtonPlaceNormally = 0,
  663.     kControlBevelButtonPlaceToRightOfGraphic = 1,
  664.     kControlBevelButtonPlaceToLeftOfGraphic = 2,
  665.     kControlBevelButtonPlaceBelowGraphic = 3,
  666.     kControlBevelButtonPlaceAboveGraphic = 4
  667. };
  668.  
  669. typedef SInt16                             ControlButtonTextPlacement;
  670. /* Add these variant codes to kBevelButtonSmallBevelProc to change the type of button */
  671.  
  672. enum {
  673.     kControlBevelButtonSmallBevelVariant = 0,
  674.     kControlBevelButtonNormalBevelVariant = (1 << 0),
  675.     kControlBevelButtonLargeBevelVariant = (1 << 1),
  676.     kControlBevelButtonMenuOnRight = (1 << 2)
  677. };
  678.  
  679. /*
  680.    Behaviors of bevel buttons. These are set up so you can add
  681.    them together with the content types.
  682. */
  683.  
  684. enum {
  685.     kControlBehaviorPushbutton    = 0,
  686.     kControlBehaviorToggles        = 0x0100,
  687.     kControlBehaviorSticky        = 0x0200,
  688.     kControlBehaviorMultiValueMenu = 0x4000,                    /* only makes sense when a menu is attached.*/
  689.     kControlBehaviorOffsetContents = 0x8000
  690. };
  691.  
  692. /* Behaviors for 1.0.1 or later */
  693.  
  694. enum {
  695.     kControlBehaviorCommandMenu    = 0x2000                        /* menu holds commands, not choices. Overrides multi-value bit.*/
  696. };
  697.  
  698. /* Content types supported by bevel buttons *and* image wells*/
  699.  
  700. enum {
  701.     kControlContentTextOnly        = 0,
  702.     kControlContentIconSuiteRes    = 1,
  703.     kControlContentCIconRes        = 2,
  704.     kControlContentPictRes        = 3,
  705.     kControlContentIconSuiteHandle = 129,
  706.     kControlContentCIconHandle    = 130,
  707.     kControlContentPictHandle    = 131,
  708.     kControlContentIconRef        = 132
  709. };
  710.  
  711. typedef SInt16                             ControlContentType;
  712. /* Data tags supported by the bevel button controls */
  713.  
  714. enum {
  715.     kControlBevelButtonContentTag = FOUR_CHAR_CODE('cont'),        /* ButtonContentInfo*/
  716.     kControlBevelButtonTransformTag = FOUR_CHAR_CODE('tran'),    /* IconTransformType*/
  717.     kControlBevelButtonTextAlignTag = FOUR_CHAR_CODE('tali'),    /* ButtonTextAlignment*/
  718.     kControlBevelButtonTextOffsetTag = FOUR_CHAR_CODE('toff'),    /* SInt16*/
  719.     kControlBevelButtonGraphicAlignTag = FOUR_CHAR_CODE('gali'), /* ButtonGraphicAlignment*/
  720.     kControlBevelButtonGraphicOffsetTag = FOUR_CHAR_CODE('goff'), /* Point*/
  721.     kControlBevelButtonTextPlaceTag = FOUR_CHAR_CODE('tplc'),    /* ButtonTextPlacement*/
  722.     kControlBevelButtonMenuValueTag = FOUR_CHAR_CODE('mval'),    /* SInt16*/
  723.     kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd'),    /* MenuHandle*/
  724.     kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') /* Boolean: true = center, false = bottom right*/
  725. };
  726.  
  727. /* These are tags in 1.0.1 or later */
  728.  
  729. enum {
  730.     kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu'),    /* SInt16: menuID of last menu item selected from*/
  731.     kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly')    /* SInt32: ticks to delay before menu appears*/
  732. };
  733.  
  734. /* tags available with Appearance 1.1 or later */
  735.  
  736. enum {
  737.                                                                 /* Boolean: True = if an icon of the ideal size for*/
  738.                                                                 /* the button isn't available, scale a larger or*/
  739.                                                                 /* smaller icon to the ideal size. False = don't*/
  740.                                                                 /* scale; draw a smaller icon or clip a larger icon.*/
  741.                                                                 /* Default is false. Only applies to IconSuites and*/
  742.     kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal')    /* IconRefs.*/
  743. };
  744.  
  745. /* Structure to pass into bevel buttons and image wells to set/get content type */
  746.  
  747. struct ControlButtonContentInfo {
  748.     ControlContentType                 contentType;
  749.     union {
  750.         SInt16                             resID;
  751.         CIconHandle                     cIconHandle;
  752.         Handle                             iconSuite;
  753.         Handle                             iconRef;
  754.         PicHandle                         picture;
  755.     }                                 u;
  756. };
  757. typedef struct ControlButtonContentInfo    ControlButtonContentInfo;
  758. typedef ControlButtonContentInfo *        ControlButtonContentInfoPtr;
  759. /*——————————————————————————————————————————————————————————————————————————————————————*/
  760. /*    • SLIDER (CDEF 3)                                                                    */
  761. /*——————————————————————————————————————————————————————————————————————————————————————*/
  762. /*    There are several variants that control the behavior of the slider control. Any        */
  763. /*    combination of the following three constants can be added to the basic CDEF ID        */
  764. /*    (kSliderProc).                                                                        */
  765. /*                                                                                        */
  766. /*    Variants:                                                                            */
  767. /*                                                                                        */
  768. /*        kSliderLiveFeedback         Slider does not use "ghosted" indicator when tracking.    */
  769. /*                                ActionProc is called (set via SetControlAction) as the    */
  770. /*                                indicator is dragged. The value is updated so that the    */
  771. /*                                actionproc can adjust some other property based on the    */
  772. /*                                value each time the action proc is called. If no action    */
  773. /*                                proc is installed, it reverts to the ghost indicator.    */
  774. /*                                                                                        */
  775. /*        kSliderHasTickMarks         Slider is drawn with 'tick marks'. The control            */
  776. /*                                rectangle must be large enough to accomidate the tick    */
  777. /*                                marks.                                                    */
  778. /*                                                                                        */
  779. /*        kSliderReverseDirection    Slider thumb points in opposite direction than normal.    */
  780. /*                                If the slider is vertical, the thumb will point to the    */
  781. /*                                left, if the slider is horizontal, the thumb will point    */
  782. /*                                upwards.                                                */
  783. /*                                                                                        */
  784. /*        kSliderNonDirectional    This option overrides the kSliderReverseDirection and    */
  785. /*                                kSliderHasTickMarks variants. It creates an indicator    */
  786. /*                                which is rectangular and doesn't point in any direction    */
  787. /*                                like the normal indicator does.                            */
  788.  
  789. enum {
  790.                                                                 /* Slider proc IDs */
  791.     kControlSliderProc            = 48,
  792.     kControlSliderLiveFeedback    = (1 << 0),
  793.     kControlSliderHasTickMarks    = (1 << 1),
  794.     kControlSliderReverseDirection = (1 << 2),
  795.     kControlSliderNonDirectional = (1 << 3)
  796. };
  797.  
  798.  
  799. /*——————————————————————————————————————————————————————————————————————————————————————*/
  800. /*    • DISCLOSURE TRIANGLE (CDEF 4)                                                        */
  801. /*——————————————————————————————————————————————————————————————————————————————————————*/
  802. /*    This control can be used as either left or right facing. It can also handle its own    */
  803. /*    tracking if you wish. This means that when the 'autotoggle' variant is used, if the    */
  804. /*    user clicks the control, it's state will change automatically from open to closed    */
  805. /*    and vice-versa depending on its initial state. After a successful call to Track-    */
  806. /*     Control, you can just check the current value to see what state it was switched to.    */
  807.  
  808. enum {
  809.                                                                 /* Triangle proc IDs */
  810.     kControlTriangleProc        = 64,
  811.     kControlTriangleLeftFacingProc = 65,
  812.     kControlTriangleAutoToggleProc = 66,
  813.     kControlTriangleLeftFacingAutoToggleProc = 67
  814. };
  815.  
  816.  
  817. enum {
  818.                                                                 /* Tagged data supported by disclosure triangles */
  819.     kControlTriangleLastValueTag = FOUR_CHAR_CODE('last')        /* SInt16*/
  820. };
  821.  
  822. /*——————————————————————————————————————————————————————————————————————————————————————*/
  823. /*    • PROGRESS INDICATOR (CDEF 5)                                                        */
  824. /*——————————————————————————————————————————————————————————————————————————————————————*/
  825. /*    This CDEF implements both determinate and indeterminate progress bars. To switch,     */
  826. /*    just use SetControlData to set the indeterminate flag to make it indeterminate call    */
  827. /*    IdleControls to step thru the animation. IdleControls should be called at least        */
  828. /*    once during your event loop.                                                        */
  829. /*                                                                                        */
  830.  
  831. enum {
  832.                                                                 /* Progress Bar proc IDs */
  833.     kControlProgressBarProc        = 80
  834. };
  835.  
  836.  
  837. enum {
  838.                                                                 /* Tagged data supported by progress bars */
  839.     kControlProgressBarIndeterminateTag = FOUR_CHAR_CODE('inde') /* Boolean*/
  840. };
  841.  
  842. /*——————————————————————————————————————————————————————————————————————————————————————*/
  843. /*    • LITTLE ARROWS (CDEF 6)                                                            */
  844. /*——————————————————————————————————————————————————————————————————————————————————————*/
  845. /*     This control implements the little up and down arrows you'd see in the Memory        */
  846. /*    control panel for adjusting the cache size.                                         */
  847.  
  848. enum {
  849.                                                                 /* Little Arrows proc IDs */
  850.     kControlLittleArrowsProc    = 96
  851. };
  852.  
  853. /*——————————————————————————————————————————————————————————————————————————————————————*/
  854. /*    • CHASING ARROWS (CDEF 7)                                                            */
  855. /*——————————————————————————————————————————————————————————————————————————————————————*/
  856. /*    To animate this control, make sure to call IdleControls repeatedly.                    */
  857. /*                                                                                        */
  858.  
  859. enum {
  860.                                                                 /* Chasing Arrows proc IDs */
  861.     kControlChasingArrowsProc    = 112
  862. };
  863.  
  864. /*——————————————————————————————————————————————————————————————————————————————————————*/
  865. /*    • TABS (CDEF 8)                                                                        */
  866. /*——————————————————————————————————————————————————————————————————————————————————————*/
  867. /*    Tabs use an auxiliary resource (tab#) to hold tab information such as the tab name    */
  868. /*    and an icon suite ID for each tab.                                                    */
  869. /*                                                                                        */
  870. /*    The ID of the tab# resource that you wish to associate with a tab control should     */
  871. /*    be passed in as the Value parameter of the control. If you are using GetNewControl, */
  872. /*    then the Value slot in the CNTL resource should have the ID of the 'tab#' resource    */
  873. /*    on creation.                                                                        */
  874. /*                                                                                        */
  875. /*    Passing zero in for the tab# resource tells the control not to read in a tab# res.    */
  876. /*    You can then use SetControlMaximum to add tabs, followed by a call to SetControlData*/
  877. /*    with the kControlTabInfoTag, passing in a pointer to a ControlTabInfoRec. This sets    */
  878. /*     the name and optionally an icon for a tab.                                            */
  879.  
  880. enum {
  881.                                                                 /* Tabs proc IDs */
  882.     kControlTabLargeProc        = 128,                            /* Large tab size, north facing    */
  883.     kControlTabSmallProc        = 129,                            /* Small tab size, north facing    */
  884.     kControlTabLargeNorthProc    = 128,                            /* Large tab size, north facing    */
  885.     kControlTabSmallNorthProc    = 129,                            /* Small tab size, north facing    */
  886.     kControlTabLargeSouthProc    = 130,                            /* Large tab size, south facing    */
  887.     kControlTabSmallSouthProc    = 131,                            /* Small tab size, south facing    */
  888.     kControlTabLargeEastProc    = 132,                            /* Large tab size, east facing    */
  889.     kControlTabSmallEastProc    = 133,                            /* Small tab size, east facing    */
  890.     kControlTabLargeWestProc    = 134,                            /* Large tab size, west facing    */
  891.     kControlTabSmallWestProc    = 135                            /* Small tab size, west facing    */
  892. };
  893.  
  894.  
  895. enum {
  896.                                                                 /* Tagged data supported by progress bars */
  897.     kControlTabContentRectTag    = FOUR_CHAR_CODE('rect'),        /* Rect*/
  898.     kControlTabEnabledFlagTag    = FOUR_CHAR_CODE('enab'),        /* Boolean*/
  899.     kControlTabFontStyleTag        = kControlFontStyleTag            /* ControlFontStyleRec*/
  900. };
  901.  
  902. /* New tags in 1.0.1 or later */
  903.  
  904. enum {
  905.     kControlTabInfoTag            = FOUR_CHAR_CODE('tabi')        /* ControlTabInfoRec*/
  906. };
  907.  
  908.  
  909. enum {
  910.     kControlTabInfoVersionZero    = 0
  911. };
  912.  
  913.  
  914. struct ControlTabInfoRec {
  915.     SInt16                             version;                    /* version of this structure.*/
  916.     SInt16                             iconSuiteID;                /* icon suite to use. Zero indicates no icon*/
  917.     Str255                             name;                        /* name to be displayed on the tab*/
  918. };
  919. typedef struct ControlTabInfoRec        ControlTabInfoRec;
  920. /*——————————————————————————————————————————————————————————————————————————————————————*/
  921. /*    • VISUAL SEPARATOR (CDEF 9)                                                            */
  922. /*——————————————————————————————————————————————————————————————————————————————————————*/
  923. /*    Separator lines determine their orientation (horizontal or vertical) automatically    */
  924. /*    based on the relative height and width of their contrlRect.                            */
  925.  
  926. enum {
  927.                                                                 /* Visual separator proc IDs */
  928.     kControlSeparatorLineProc    = 144
  929. };
  930.  
  931.  
  932. /*——————————————————————————————————————————————————————————————————————————————————————*/
  933. /*    • GROUP BOX (CDEF 10)                                                                */
  934. /*——————————————————————————————————————————————————————————————————————————————————————*/
  935. /*    The group box CDEF can be use in several ways. It can have no title, a text title,     */
  936. /*    a check box as the title, or a popup button as a title. There are two versions of     */
  937. /*    group boxes, primary and secondary, which look slightly different.                    */
  938.  
  939. enum {
  940.                                                                 /* Group Box proc IDs */
  941.     kControlGroupBoxTextTitleProc = 160,
  942.     kControlGroupBoxCheckBoxProc = 161,
  943.     kControlGroupBoxPopupButtonProc = 162,
  944.     kControlGroupBoxSecondaryTextTitleProc = 164,
  945.     kControlGroupBoxSecondaryCheckBoxProc = 165,
  946.     kControlGroupBoxSecondaryPopupButtonProc = 166
  947. };
  948.  
  949.  
  950. enum {
  951.                                                                 /* Tagged data supported by group box */
  952.     kControlGroupBoxMenuHandleTag = FOUR_CHAR_CODE('mhan'),        /* MenuHandle (popup title only)*/
  953.     kControlGroupBoxFontStyleTag = kControlFontStyleTag            /* ControlFontStyleRec*/
  954. };
  955.  
  956. /* tags available with Appearance 1.1 or later */
  957.  
  958. enum {
  959.     kControlGroupBoxTitleRectTag = FOUR_CHAR_CODE('trec')        /* Rect. Rectangle that the title text/control is drawn in. (get only)*/
  960. };
  961.  
  962. /*——————————————————————————————————————————————————————————————————————————————————————*/
  963. /*    • IMAGE WELL (CDEF 11)                                                                */
  964. /*——————————————————————————————————————————————————————————————————————————————————————*/
  965. /*    Image Wells allow you to control the content type (pict/icon/etc.) shown in the     */
  966. /*    well.                                                                                */
  967. /*                                                                                        */
  968. /*    This is made possible by overloading the Min and Value parameters for the control.    */
  969. /*                                                                                        */
  970. /*    Parameter                    What Goes Here                                            */
  971. /*    ———————————————————            ——————————————————————————————————————————————————        */
  972. /*    Min                            content type (see constants for bevel buttons)            */
  973. /*    Value                        Resource ID of content type, if resource-based.            */
  974. /*                                                                                        */
  975. /*                                                                                        */
  976. /*    Handle-based Content                                                                */
  977. /*    ————————————————————                                                                */
  978. /*    You can create your control and then set the content to an existing handle to an    */
  979. /*    icon suite, etc. using the macros below. Please keep in mind that resource-based    */
  980. /*    content is owned by the control, handle-based content is owned by you. The CDEF will*/
  981. /*    not try to dispose of handle-based content. If you are changing the content type of    */
  982. /*    the button on the fly, you must make sure that if you are replacing a handle-        */
  983. /*    based content with a resource-based content to properly dispose of the handle,        */
  984. /*    else a memory leak will ensue.                                                        */
  985. /*                                                                                        */
  986.  
  987. enum {
  988.                                                                 /* Image Well proc IDs */
  989.     kControlImageWellProc        = 176
  990. };
  991.  
  992.  
  993. enum {
  994.                                                                 /* Tagged data supported by image wells */
  995.     kControlImageWellContentTag    = FOUR_CHAR_CODE('cont'),        /* ButtonContentInfo*/
  996.     kControlImageWellTransformTag = FOUR_CHAR_CODE('tran')        /* IconTransformType*/
  997. };
  998.  
  999. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1000. /*    • POPUP ARROW (CDEF 12)                                                                */
  1001. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1002. /*    The popup arrow CDEF is used to draw the small arrow normally associated with a     */
  1003. /*    popup control. The arrow can point in four directions, and a small or large version */
  1004. /*    can be used. This control is provided to allow clients to draw the arrow in a         */
  1005. /*    normalized fashion which will take advantage of themes automatically.                */
  1006. /*                                                                                        */
  1007.  
  1008. enum {
  1009.                                                                 /* Popup Arrow proc IDs */
  1010.     kControlPopupArrowEastProc    = 192,
  1011.     kControlPopupArrowWestProc    = 193,
  1012.     kControlPopupArrowNorthProc    = 194,
  1013.     kControlPopupArrowSouthProc    = 195,
  1014.     kControlPopupArrowSmallEastProc = 196,
  1015.     kControlPopupArrowSmallWestProc = 197,
  1016.     kControlPopupArrowSmallNorthProc = 198,
  1017.     kControlPopupArrowSmallSouthProc = 199
  1018. };
  1019.  
  1020. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1021. /*    • PLACARD (CDEF 14)                                                                    */
  1022. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1023.  
  1024. enum {
  1025.                                                                 /* Placard proc IDs */
  1026.     kControlPlacardProc            = 224
  1027. };
  1028.  
  1029. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1030. /*    • CLOCK (CDEF 15)                                                                    */
  1031. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1032. /*     NOTE:    You can specify more options in the Value paramter when creating the clock.    */
  1033. /*            See below.                                                                    */
  1034. /*                                                                                        */
  1035. /*    NOTE:    Under Appearance 1.1, the clock control knows and returns more part codes.    */
  1036. /*            The new clock-specific part codes are defined with the other control parts.    */
  1037. /*            Besides these clock-specific parts, we also return kControlUpButtonPart        */
  1038. /*            and kControlDownButtonPart when they hit the up and down arrows.            */
  1039. /*            The new part codes give you more flexibility for focusing and hit testing.    */
  1040. /*                                                                                        */
  1041. /*            The original kControlClockPart is still valid. When hit testing, it means    */
  1042. /*            that some non-editable area of the clock's whitespace has been clicked.        */
  1043. /*            When focusing a currently unfocused clock, it changes the focus to the        */
  1044. /*            first part; it is the same as passing kControlFocusNextPart. When            */
  1045. /*            re-focusing a focused clock, it will not change the focus at all.            */
  1046.  
  1047. enum {
  1048.                                                                 /* Clock proc IDs */
  1049.     kControlClockTimeProc        = 240,
  1050.     kControlClockTimeSecondsProc = 241,
  1051.     kControlClockDateProc        = 242,
  1052.     kControlClockMonthYearProc    = 243
  1053. };
  1054.  
  1055. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1056. /*     These flags can be passed into 'value' field on creation of the control.            */
  1057. /*     Value is set to 0 after control is created.                                            */
  1058. /*                                                                                        */
  1059. /*    The kClockIsLive value tells the clock to automatically update on idle (clock will    */
  1060. /*    have the current time). This flag is only valid when the kClockIsDisplayOnly flag    */
  1061. /*    is set.                                                                                */
  1062. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1063.  
  1064. enum {
  1065.     kControlClockNoFlags        = 0,
  1066.     kControlClockIsDisplayOnly    = 1,
  1067.     kControlClockIsLive            = 2
  1068. };
  1069.  
  1070.  
  1071. enum {
  1072.                                                                 /* Tagged data supported by clocks */
  1073.     kControlClockLongDateTag    = FOUR_CHAR_CODE('date'),        /* LongDateRec*/
  1074.     kControlClockFontStyleTag    = kControlFontStyleTag            /* ControlFontStyleRec*/
  1075. };
  1076.  
  1077. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1078. /*    • USER PANE (CDEF 16)                                                                */
  1079. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1080.  
  1081. enum {
  1082.                                                                 /* User Pane proc IDs */
  1083.     kControlUserPaneProc        = 256
  1084. };
  1085.  
  1086. /* Tagged data supported by user panes */
  1087. /* Currently, they are all proc ptrs for doing things like drawing and hit testing, etc. */
  1088.  
  1089. enum {
  1090.     kControlUserItemDrawProcTag    = FOUR_CHAR_CODE('uidp'),        /* UserItemUPP*/
  1091.     kControlUserPaneDrawProcTag    = FOUR_CHAR_CODE('draw'),        /* ControlUserPaneDrawingUPP*/
  1092.     kControlUserPaneHitTestProcTag = FOUR_CHAR_CODE('hitt'),    /* ControlUserPaneHitTestUPP*/
  1093.     kControlUserPaneTrackingProcTag = FOUR_CHAR_CODE('trak'),    /* ControlUserPaneTrackingUPP*/
  1094.     kControlUserPaneIdleProcTag    = FOUR_CHAR_CODE('idle'),        /* ControlUserPaneIdleUPP*/
  1095.     kControlUserPaneKeyDownProcTag = FOUR_CHAR_CODE('keyd'),    /* ControlUserPaneKeyDownUPP*/
  1096.     kControlUserPaneActivateProcTag = FOUR_CHAR_CODE('acti'),    /* ControlUserPaneActivateUPP*/
  1097.     kControlUserPaneFocusProcTag = FOUR_CHAR_CODE('foci'),        /* ControlUserPaneFocusUPP*/
  1098.     kControlUserPaneBackgroundProcTag = FOUR_CHAR_CODE('back')    /* ControlUserPaneBackgroundUPP*/
  1099. };
  1100.  
  1101. typedef CALLBACK_API( void , ControlUserPaneDrawProcPtr )(ControlHandle control, SInt16 part);
  1102. typedef CALLBACK_API( ControlPartCode , ControlUserPaneHitTestProcPtr )(ControlHandle control, Point where);
  1103. typedef CALLBACK_API( ControlPartCode , ControlUserPaneTrackingProcPtr )(ControlHandle control, Point startPt, ControlActionUPP actionProc);
  1104. typedef CALLBACK_API( void , ControlUserPaneIdleProcPtr )(ControlHandle control);
  1105. typedef CALLBACK_API( ControlPartCode , ControlUserPaneKeyDownProcPtr )(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers);
  1106. typedef CALLBACK_API( void , ControlUserPaneActivateProcPtr )(ControlHandle control, Boolean activating);
  1107. typedef CALLBACK_API( ControlPartCode , ControlUserPaneFocusProcPtr )(ControlHandle control, ControlFocusPart action);
  1108. typedef CALLBACK_API( void , ControlUserPaneBackgroundProcPtr )(ControlHandle control, ControlBackgroundPtr info);
  1109. typedef STACK_UPP_TYPE(ControlUserPaneDrawProcPtr)                 ControlUserPaneDrawUPP;
  1110. typedef STACK_UPP_TYPE(ControlUserPaneHitTestProcPtr)             ControlUserPaneHitTestUPP;
  1111. typedef STACK_UPP_TYPE(ControlUserPaneTrackingProcPtr)             ControlUserPaneTrackingUPP;
  1112. typedef STACK_UPP_TYPE(ControlUserPaneIdleProcPtr)                 ControlUserPaneIdleUPP;
  1113. typedef STACK_UPP_TYPE(ControlUserPaneKeyDownProcPtr)             ControlUserPaneKeyDownUPP;
  1114. typedef STACK_UPP_TYPE(ControlUserPaneActivateProcPtr)             ControlUserPaneActivateUPP;
  1115. typedef STACK_UPP_TYPE(ControlUserPaneFocusProcPtr)             ControlUserPaneFocusUPP;
  1116. typedef STACK_UPP_TYPE(ControlUserPaneBackgroundProcPtr)         ControlUserPaneBackgroundUPP;
  1117. enum { uppControlUserPaneDrawProcInfo = 0x000002C0 };             /* pascal no_return_value Func(4_bytes, 2_bytes) */
  1118. enum { uppControlUserPaneHitTestProcInfo = 0x000003E0 };         /* pascal 2_bytes Func(4_bytes, 4_bytes) */
  1119. enum { uppControlUserPaneTrackingProcInfo = 0x00000FE0 };         /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1120. enum { uppControlUserPaneIdleProcInfo = 0x000000C0 };             /* pascal no_return_value Func(4_bytes) */
  1121. enum { uppControlUserPaneKeyDownProcInfo = 0x00002AE0 };         /* pascal 2_bytes Func(4_bytes, 2_bytes, 2_bytes, 2_bytes) */
  1122. enum { uppControlUserPaneActivateProcInfo = 0x000001C0 };         /* pascal no_return_value Func(4_bytes, 1_byte) */
  1123. enum { uppControlUserPaneFocusProcInfo = 0x000002E0 };             /* pascal 2_bytes Func(4_bytes, 2_bytes) */
  1124. enum { uppControlUserPaneBackgroundProcInfo = 0x000003C0 };     /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1125. #define NewControlUserPaneDrawProc(userRoutine)                 (ControlUserPaneDrawUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneDrawProcInfo, GetCurrentArchitecture())
  1126. #define NewControlUserPaneHitTestProc(userRoutine)                 (ControlUserPaneHitTestUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneHitTestProcInfo, GetCurrentArchitecture())
  1127. #define NewControlUserPaneTrackingProc(userRoutine)             (ControlUserPaneTrackingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneTrackingProcInfo, GetCurrentArchitecture())
  1128. #define NewControlUserPaneIdleProc(userRoutine)                 (ControlUserPaneIdleUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneIdleProcInfo, GetCurrentArchitecture())
  1129. #define NewControlUserPaneKeyDownProc(userRoutine)                 (ControlUserPaneKeyDownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneKeyDownProcInfo, GetCurrentArchitecture())
  1130. #define NewControlUserPaneActivateProc(userRoutine)             (ControlUserPaneActivateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneActivateProcInfo, GetCurrentArchitecture())
  1131. #define NewControlUserPaneFocusProc(userRoutine)                 (ControlUserPaneFocusUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneFocusProcInfo, GetCurrentArchitecture())
  1132. #define NewControlUserPaneBackgroundProc(userRoutine)             (ControlUserPaneBackgroundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneBackgroundProcInfo, GetCurrentArchitecture())
  1133. #define CallControlUserPaneDrawProc(userRoutine, control, part)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneDrawProcInfo, (control), (part))
  1134. #define CallControlUserPaneHitTestProc(userRoutine, control, where)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneHitTestProcInfo, (control), (where))
  1135. #define CallControlUserPaneTrackingProc(userRoutine, control, startPt, actionProc)  CALL_THREE_PARAMETER_UPP((userRoutine), uppControlUserPaneTrackingProcInfo, (control), (startPt), (actionProc))
  1136. #define CallControlUserPaneIdleProc(userRoutine, control)         CALL_ONE_PARAMETER_UPP((userRoutine), uppControlUserPaneIdleProcInfo, (control))
  1137. #define CallControlUserPaneKeyDownProc(userRoutine, control, keyCode, charCode, modifiers)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlUserPaneKeyDownProcInfo, (control), (keyCode), (charCode), (modifiers))
  1138. #define CallControlUserPaneActivateProc(userRoutine, control, activating)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneActivateProcInfo, (control), (activating))
  1139. #define CallControlUserPaneFocusProc(userRoutine, control, action)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneFocusProcInfo, (control), (action))
  1140. #define CallControlUserPaneBackgroundProc(userRoutine, control, info)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneBackgroundProcInfo, (control), (info))
  1141. /*
  1142.   ——————————————————————————————————————————————————————————————————————————————————————————
  1143.       • EDIT TEXT (CDEF 17)
  1144.   ——————————————————————————————————————————————————————————————————————————————————————————
  1145. */
  1146.  
  1147. enum {
  1148.                                                                 /* Edit Text proc IDs */
  1149.     kControlEditTextProc        = 272,
  1150.     kControlEditTextPasswordProc = 274
  1151. };
  1152.  
  1153. /* proc IDs available with Appearance 1.1 or later */
  1154.  
  1155. enum {
  1156.     kControlEditTextInlineInputProc = 276                        /* Can't combine with the other variants*/
  1157. };
  1158.  
  1159.  
  1160. enum {
  1161.                                                                 /* Tagged data supported by edit text */
  1162.     kControlEditTextStyleTag    = kControlFontStyleTag,            /* ControlFontStyleRec*/
  1163.     kControlEditTextTextTag        = FOUR_CHAR_CODE('text'),        /* Buffer of chars - you supply the buffer*/
  1164.     kControlEditTextTEHandleTag    = FOUR_CHAR_CODE('than'),        /* The TEHandle of the text edit record*/
  1165.     kControlEditTextKeyFilterTag = kControlKeyFilterTag,
  1166.     kControlEditTextSelectionTag = FOUR_CHAR_CODE('sele'),        /* EditTextSelectionRec*/
  1167.     kControlEditTextPasswordTag    = FOUR_CHAR_CODE('pass')        /* The clear text password text*/
  1168. };
  1169.  
  1170. /* tags available with Appearance 1.1 or later */
  1171.  
  1172. enum {
  1173.     kControlEditTextKeyScriptBehaviorTag = FOUR_CHAR_CODE('kscr'), /* ControlKeyScriptBehavior. Defaults to "PrefersRoman" for password fields,*/
  1174.                                                                 /*        or "AllowAnyScript" for non-password fields.*/
  1175.     kControlEditTextLockedTag    = FOUR_CHAR_CODE('lock'),        /* Boolean. Locking disables editability.*/
  1176.     kControlEditTextFixedTextTag = FOUR_CHAR_CODE('ftxt'),        /* Like the normal text tag, but fixes inline input first*/
  1177.     kControlEditTextValidationProcTag = FOUR_CHAR_CODE('vali'),    /* ControlEditTextValidationUPP. Called when a key filter can't be: after cut, paste, etc.*/
  1178.     kControlEditTextInlinePreUpdateProcTag = FOUR_CHAR_CODE('prup'), /* TSMTEPreUpdateUPP and TSMTEPostUpdateUpp. For use with inline input variant...*/
  1179.     kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') /* ...The refCon parameter will contain the ControlHandle.*/
  1180. };
  1181.  
  1182.  
  1183. struct ControlEditTextSelectionRec {
  1184.                                                                 /* Structure for getting the edit text selection */
  1185.     SInt16                             selStart;
  1186.     SInt16                             selEnd;
  1187. };
  1188. typedef struct ControlEditTextSelectionRec ControlEditTextSelectionRec;
  1189.  
  1190. typedef ControlEditTextSelectionRec *    ControlEditTextSelectionPtr;
  1191. typedef CALLBACK_API( void , ControlEditTextValidationProcPtr )(ControlHandle control);
  1192. typedef STACK_UPP_TYPE(ControlEditTextValidationProcPtr)         ControlEditTextValidationUPP;
  1193. enum { uppControlEditTextValidationProcInfo = 0x000000C0 };     /* pascal no_return_value Func(4_bytes) */
  1194. #define NewControlEditTextValidationProc(userRoutine)             (ControlEditTextValidationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlEditTextValidationProcInfo, GetCurrentArchitecture())
  1195. #define CallControlEditTextValidationProc(userRoutine, control)  CALL_ONE_PARAMETER_UPP((userRoutine), uppControlEditTextValidationProcInfo, (control))
  1196. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1197. /*    • STATIC TEXT (CDEF 18)                                                                */
  1198. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1199. /* Static Text proc IDs */
  1200.  
  1201. enum {
  1202.     kControlStaticTextProc        = 288
  1203. };
  1204.  
  1205. /* Tagged data supported by static text */
  1206.  
  1207. enum {
  1208.     kControlStaticTextStyleTag    = kControlFontStyleTag,            /* ControlFontStyleRec*/
  1209.     kControlStaticTextTextTag    = FOUR_CHAR_CODE('text'),        /* Copy of text*/
  1210.     kControlStaticTextTextHeightTag = FOUR_CHAR_CODE('thei')    /* SInt16*/
  1211. };
  1212.  
  1213. /* Tags available with appearance 1.1 or later */
  1214.  
  1215. enum {
  1216.     kControlStaticTextTruncTag    = FOUR_CHAR_CODE('trun')        /* TruncCode (-1 means no truncation)*/
  1217. };
  1218.  
  1219. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1220. /*    • PICTURE CONTROL (CDEF 19)                                                            */
  1221. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1222. /*    Value parameter should contain the ID of the picture you wish to display when        */
  1223. /*    creating controls of this type. If you don't want the control tracked at all, use     */
  1224. /*    the 'no track' variant.                                                                */
  1225.  
  1226. enum {
  1227.                                                                 /* Picture control proc IDs */
  1228.     kControlPictureProc            = 304,
  1229.     kControlPictureNoTrackProc    = 305                            /* immediately returns kControlPicturePart*/
  1230. };
  1231.  
  1232. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1233. /*    • ICON CONTROL (CDEF 20)                                                            */
  1234. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1235. /*    Value parameter should contain the ID of the ICON or cicn you wish to display when    */
  1236. /*    creating controls of this type. If you don't want the control tracked at all, use     */
  1237. /*    the 'no track' variant.                                                                */
  1238. /* Icon control proc IDs */
  1239.  
  1240. enum {
  1241.     kControlIconProc            = 320,
  1242.     kControlIconNoTrackProc        = 321,                            /* immediately returns kControlIconPart*/
  1243.     kControlIconSuiteProc        = 322,
  1244.     kControlIconSuiteNoTrackProc = 323                            /* immediately returns kControlIconPart*/
  1245. };
  1246.  
  1247.  
  1248. enum {
  1249.                                                                 /* icon ref controls may have either an icon, color icon, icon suite, or icon ref.*/
  1250.                                                                 /* for data other than icon, you must set the data by passing a*/
  1251.                                                                 /* ControlButtonContentInfo to SetControlData*/
  1252.     kControlIconRefProc            = 324,
  1253.     kControlIconRefNoTrackProc    = 325                            /* immediately returns kControlIconPart*/
  1254. };
  1255.  
  1256. /* Tagged data supported by icon controls */
  1257.  
  1258. enum {
  1259.     kControlIconTransformTag    = FOUR_CHAR_CODE('trfm'),        /* IconTransformType*/
  1260.     kControlIconAlignmentTag    = FOUR_CHAR_CODE('algn')        /* IconAlignmentType*/
  1261. };
  1262.  
  1263. /* Tags available with appearance 1.1 or later */
  1264.  
  1265. enum {
  1266.     kControlIconResourceIDTag    = FOUR_CHAR_CODE('ires'),        /* SInt16 resource ID of icon to use*/
  1267.     kControlIconContentTag        = FOUR_CHAR_CODE('cont')        /* accepts a ControlButtonContentInfo*/
  1268. };
  1269.  
  1270. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1271. /*    • WINDOW HEADER (CDEF 21)                                                            */
  1272. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1273.  
  1274. enum {
  1275.                                                                 /* Window Header proc IDs */
  1276.     kControlWindowHeaderProc    = 336,                            /* normal header*/
  1277.     kControlWindowListViewHeaderProc = 337                        /* variant for list views - no bottom line*/
  1278. };
  1279.  
  1280. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1281. /*    • LIST BOX (CDEF 22)                                                                */
  1282. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1283. /*    Lists use an auxiliary resource to define their format. The resource type used is     */
  1284. /*    'ldes' and a definition for it can be found in Appearance.r. The resource ID for     */
  1285. /*    the ldes is passed in the 'value' parameter when creating the control. You may pass */
  1286. /*    zero in value. This tells the List Box control to not use a resource. The list will */
  1287. /*    be created with default values, and will use the standard LDEF (0). You can change    */
  1288. /*    the list by getting the list handle. You can set the LDEF to use by using the tag    */
  1289. /*    below (kControlListBoxLDEFTag)                                                        */
  1290.  
  1291. enum {
  1292.                                                                 /* List Box proc IDs */
  1293.     kControlListBoxProc            = 352,
  1294.     kControlListBoxAutoSizeProc    = 353
  1295. };
  1296.  
  1297.  
  1298. enum {
  1299.                                                                 /* Tagged data supported by list box */
  1300.     kControlListBoxListHandleTag = FOUR_CHAR_CODE('lhan'),        /* ListHandle*/
  1301.     kControlListBoxKeyFilterTag    = kControlKeyFilterTag,            /* ControlKeyFilterUPP*/
  1302.     kControlListBoxFontStyleTag    = kControlFontStyleTag            /* ControlFontStyleRec*/
  1303. };
  1304.  
  1305. /* New tags in 1.0.1 or later */
  1306.  
  1307. enum {
  1308.     kControlListBoxDoubleClickTag = FOUR_CHAR_CODE('dblc'),        /* Boolean. Was last click a double-click?*/
  1309.     kControlListBoxLDEFTag        = FOUR_CHAR_CODE('ldef')        /* SInt16. ID of LDEF to use.*/
  1310. };
  1311.  
  1312. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1313. /*    • PUSH BUTTON (CDEF 23)                                                                */
  1314. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1315. /*    The new standard checkbox and radio button controls support a "mixed" value that    */
  1316. /*    indicates that the current setting contains a mixed set of on and off values. The     */
  1317. /*    control value used to display this indication is defined in Controls.h:                */
  1318. /*                                                                                        */
  1319. /*        kControlCheckBoxMixedValue = 2                                                    */
  1320. /*                                                                                        */
  1321. /*    Two new variants of the standard pushbutton have been added to the standard control    */
  1322. /*    suite that draw a color icon next to the control title. One variant draws the icon    */
  1323. /*    on the left side, the other draws it on the right side (when the system justifica-    */
  1324. /*    tion is right to left, these are reversed).                                            */
  1325. /*                                                                                        */
  1326. /*    When either of the icon pushbuttons are created, the contrlMax field of the control */
  1327. /*    record is used to determine the ID of the 'cicn' resource drawn in the pushbutton.    */
  1328. /*                                                                                        */
  1329. /*    In addition, a push button can now be told to draw with a default outline using the    */
  1330. /*    SetControlData routine with the kPushButtonDefaultTag below.                        */
  1331. /*                                                                                        */
  1332. /*    A push button may also be marked using the kControlPushButtonCancelTag. This has    */
  1333. /*    no visible representation, but does cause the button to play the CancelButton theme    */
  1334. /*    sound instead of the regular pushbutton theme sound when pressed.                    */
  1335. /*                                                                                        */
  1336.  
  1337. enum {
  1338.                                                                 /* Theme Push Button/Check Box/Radio Button proc IDs */
  1339.     kControlPushButtonProc        = 368,
  1340.     kControlCheckBoxProc        = 369,
  1341.     kControlRadioButtonProc        = 370,
  1342.     kControlPushButLeftIconProc    = 374,                            /* Standard pushbutton with left-side icon*/
  1343.     kControlPushButRightIconProc = 375                            /* Standard pushbutton with right-side icon*/
  1344. };
  1345.  
  1346. /* Variants with Appearance 1.1 or later */
  1347.  
  1348. enum {
  1349.     kControlCheckBoxAutoToggleProc = 371,
  1350.     kControlRadioButtonAutoToggleProc = 372
  1351. };
  1352.  
  1353.  
  1354. enum {
  1355.                                                                 /* Tagged data supported by standard buttons */
  1356.     kControlPushButtonDefaultTag = FOUR_CHAR_CODE('dflt')        /* default ring flag*/
  1357. };
  1358.  
  1359.  
  1360. enum {
  1361.     kControlPushButtonCancelTag    = FOUR_CHAR_CODE('cncl')        /* cancel button flag (1.1 and later)*/
  1362. };
  1363.  
  1364. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1365. /*    • SCROLL BAR (CDEF 24)                                                                */
  1366. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1367. /*    This is the new Appearance scroll bar.                                                */
  1368. /*                                                                                        */
  1369.  
  1370. enum {
  1371.                                                                 /* Theme Scroll Bar proc IDs */
  1372.     kControlScrollBarProc        = 384,                            /* normal scroll bar*/
  1373.     kControlScrollBarLiveProc    = 386                            /* live scrolling variant*/
  1374. };
  1375.  
  1376. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1377. /*    • POPUP BUTTON (CDEF 25)                                                            */
  1378. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1379. /*    This is the new Appearance Popup Button. It takes the same variants and does the     */
  1380. /*    same overloading as the previous popup menu control. There are some differences:    */
  1381. /*                                                                                        */
  1382. /*    Passing in a menu ID of -12345 causes the popup not to try and get the menu from a    */
  1383. /*    resource. Instead, you can build the menu and later stuff the menuhandle field in     */
  1384. /*    the popup data information.                                                            */
  1385. /*                                                                                        */
  1386. /*    You can pass -1 in the Max parameter to have the control calculate the width of the    */
  1387. /*    title on its own instead of guessing and then tweaking to get it right. It adds the    */
  1388. /*    appropriate amount of space between the title and the popup.                        */
  1389. /*                                                                                        */
  1390.  
  1391. enum {
  1392.                                                                 /* Theme Popup Button proc IDs */
  1393.     kControlPopupButtonProc        = 400,
  1394.     kControlPopupFixedWidthVariant = 1 << 0,
  1395.     kControlPopupVariableWidthVariant = 1 << 1,
  1396.     kControlPopupUseAddResMenuVariant = 1 << 2,
  1397.     kControlPopupUseWFontVariant = 1 << 3                        /* kControlUsesOwningWindowsFontVariant*/
  1398. };
  1399.  
  1400. /* These tags are available in 1.0.1 or later of Appearance */
  1401.  
  1402. enum {
  1403.     kControlPopupButtonMenuHandleTag = FOUR_CHAR_CODE('mhan'),    /* MenuHandle*/
  1404.     kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid')        /* SInt16*/
  1405. };
  1406.  
  1407. /* These tags are available in 1.1 or later of Appearance */
  1408.  
  1409. enum {
  1410.     kControlPopupButtonExtraHeightTag = FOUR_CHAR_CODE('exht')    /* SInt16 extra vertical whitespace within the button*/
  1411. };
  1412.  
  1413.  
  1414. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1415. /*    • RADIO GROUP (CDEF 26)                                                                */
  1416. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1417. /*    This control implements a radio group. It is an embedding control and can therefore    */
  1418. /*     only be used when a control hierarchy is established for its owning window. You        */
  1419. /*    should only embed radio buttons within it. As radio buttons are embedded into it,    */
  1420. /*    the group sets up its value, min, and max to represent the number of embedded items.*/
  1421. /*    The current value of the control is the index of the sub-control that is the current*/
  1422. /*    'on' radio button. To get the current radio button control handle, you can use the    */
  1423. /*    control manager call GetIndSubControl, passing in the value of the radio group.        */
  1424. /*                                                                                        */
  1425. /*    NOTE: This control is only available with Appearance 1.0.1.                            */
  1426.  
  1427. enum {
  1428.     kControlRadioGroupProc        = 416
  1429. };
  1430.  
  1431. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1432. /*    • SCROLL TEXT BOX (CDEF 27)                                                            */
  1433. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1434. /*    This control implements a scrolling box of (non-editable) text.    This is useful for    */
  1435. /*    credits in about boxes, etc.                                                        */
  1436. /*    The standard version of this control has a scroll bar, but the autoscrolling        */
  1437. /*    variant does not. The autoscrolling variant needs two pieces of information to        */
  1438. /*    work: delay (in ticks) before the scrolling starts, and time (in ticks) between        */
  1439. /*    scrolls. It will scroll one pixel at a time, unless changed via SetControlData.        */
  1440. /*                                                                                        */
  1441. /*    Parameter                    What Goes Here                                            */
  1442. /*    ———————————————————            ————————————————————————————————————————————————————    */
  1443. /*    Value                        Resource ID of 'TEXT'/'styl' content.                    */
  1444. /*    Min                            Scroll start delay (in ticks)                        .    */
  1445. /*    Max                            Delay (in ticks) between scrolls.                        */
  1446. /*                                                                                        */
  1447. /*    NOTE: This control is only available with Appearance 1.1.                            */
  1448.  
  1449. enum {
  1450.     kControlScrollTextBoxProc    = 432,
  1451.     kControlScrollTextBoxAutoScrollProc = 433
  1452. };
  1453.  
  1454.  
  1455. enum {
  1456.     kControlScrollTextBoxDelayBeforeAutoScrollTag = FOUR_CHAR_CODE('stdl'), /* UInt32 (ticks until autoscrolling starts)*/
  1457.     kControlScrollTextBoxDelayBetweenAutoScrollTag = FOUR_CHAR_CODE('scdl'), /* UInt32 (ticks between scrolls)*/
  1458.     kControlScrollTextBoxAutoScrollAmountTag = FOUR_CHAR_CODE('samt'), /* UInt16 (pixels per scroll) -- defaults to 1*/
  1459.     kControlScrollTextBoxContentsTag = FOUR_CHAR_CODE('tres')    /* SInt16 (resource ID of 'TEXT'/'styl') -- write only!*/
  1460. };
  1461.  
  1462.  
  1463. /*  —— end of stuff only available with Appearance 1.0 and later*/
  1464.  
  1465.  
  1466. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1467. /*    • Control Variants                                                                    */
  1468. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1469. typedef SInt16                             ControlVariant;
  1470.  
  1471. enum {
  1472.     kControlNoVariant            = 0,                            /* No variant*/
  1473.     kControlUsesOwningWindowsFontVariant = 1 << 3                /* Control uses owning windows font to display text*/
  1474. };
  1475.  
  1476. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1477. /*    • Control Part Codes                                                                */
  1478. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1479.  
  1480. enum {
  1481.     kControlNoPart                = 0,
  1482.     kControlLabelPart            = 1,
  1483.     kControlMenuPart            = 2,
  1484.     kControlTrianglePart        = 4,
  1485.     kControlEditTextPart        = 5,                            /* Appearance 1.0 and later*/
  1486.     kControlPicturePart            = 6,                            /* Appearance 1.0 and later*/
  1487.     kControlIconPart            = 7,                            /* Appearance 1.0 and later*/
  1488.     kControlClockPart            = 8,                            /* Appearance 1.0 and later*/
  1489.     kControlListBoxPart            = 24,                            /* Appearance 1.0 and later*/
  1490.     kControlListBoxDoubleClickPart = 25,                        /* Appearance 1.0 and later*/
  1491.     kControlImageWellPart        = 26,                            /* Appearance 1.0 and later*/
  1492.     kControlRadioGroupPart        = 27,                            /* Appearance 1.0.2 and later*/
  1493.     kControlButtonPart            = 10,
  1494.     kControlCheckBoxPart        = 11,
  1495.     kControlRadioButtonPart        = 11,
  1496.     kControlUpButtonPart        = 20,
  1497.     kControlDownButtonPart        = 21,
  1498.     kControlPageUpPart            = 22,
  1499.     kControlPageDownPart        = 23,
  1500.     kControlIndicatorPart        = 129,
  1501.     kControlDisabledPart        = 254,
  1502.     kControlInactivePart        = 255
  1503. };
  1504.  
  1505.  
  1506. enum {
  1507.     kControlClockHourDayPart    = 9,                            /* Appearance 1.1 and later*/
  1508.     kControlClockMinuteMonthPart = 10,                            /* Appearance 1.1 and later*/
  1509.     kControlClockSecondYearPart    = 11,                            /* Appearance 1.1 and later*/
  1510.     kControlClockAMPMPart        = 12                            /* Appearance 1.1 and later*/
  1511. };
  1512.  
  1513. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1514. /*     Meta-Parts                                                                            */
  1515. /*
  1516. |*     If you haven't guessed from looking at other toolbox headers. We like the word         */
  1517. /*    'meta'. It's cool. So here's one more for you. A meta-part is a part used in a call    */
  1518. /*     to the GetControlRegion API. These parts are parts that might be defined by a        */
  1519. /*    control, but should not be returned from calls like TestControl, et al. They define    */
  1520. /*     a region of a control, presently the structure and the content region. The content    */
  1521. /*     region is only defined by controls that can embed other controls. It is the area    */
  1522. /*     that embedded content can live.                                                        */
  1523. /*                                                                                        */
  1524. /*    Along with these parts, you can also pass in normal part codes to get the regions    */
  1525. /*     of the parts. Not all controls fully support this at the time this was written.        */
  1526. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1527.  
  1528. enum {
  1529.     kControlStructureMetaPart    = -1,
  1530.     kControlContentMetaPart        = -2
  1531. };
  1532.  
  1533.  
  1534. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1535. /*    • Check Box Values                                                                    */
  1536. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1537.  
  1538. enum {
  1539.     kControlCheckBoxUncheckedValue = 0,
  1540.     kControlCheckBoxCheckedValue = 1,
  1541.     kControlCheckBoxMixedValue    = 2
  1542. };
  1543.  
  1544. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1545. /*    • Radio Button Values                                                                */
  1546. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1547.  
  1548. enum {
  1549.     kControlRadioButtonUncheckedValue = 0,
  1550.     kControlRadioButtonCheckedValue = 1,
  1551.     kControlRadioButtonMixedValue = 2
  1552. };
  1553.  
  1554. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1555. /*    • Pop-Up Menu Control Constants                                                        */
  1556. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1557. /* Variant codes for the System 7 pop-up menu*/
  1558.  
  1559. enum {
  1560.     popupFixedWidth                = 1 << 0,
  1561.     popupVariableWidth            = 1 << 1,
  1562.     popupUseAddResMenu            = 1 << 2,
  1563.     popupUseWFont                = 1 << 3
  1564. };
  1565.  
  1566. /* Menu label styles for the System 7 pop-up menu*/
  1567.  
  1568. enum {
  1569.     popupTitleBold                = 1 << 8,
  1570.     popupTitleItalic            = 1 << 9,
  1571.     popupTitleUnderline            = 1 << 10,
  1572.     popupTitleOutline            = 1 << 11,
  1573.     popupTitleShadow            = 1 << 12,
  1574.     popupTitleCondense            = 1 << 13,
  1575.     popupTitleExtend            = 1 << 14,
  1576.     popupTitleNoStyle            = 1 << 15
  1577. };
  1578.  
  1579. /* Menu label justifications for the System 7 pop-up menu*/
  1580.  
  1581. enum {
  1582.     popupTitleLeftJust            = 0x00000000,
  1583.     popupTitleCenterJust        = 0x00000001,
  1584.     popupTitleRightJust            = 0x000000FF
  1585. };
  1586.  
  1587. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1588. /*     • DragGrayRgn Constatns                                                                */
  1589. /*                                                                                        */
  1590. /*   For DragGrayRgnUPP used in TrackControl()                                             */
  1591. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1592.  
  1593. enum {
  1594.     noConstraint                = kNoConstraint,
  1595.     hAxisOnly                    = 1,
  1596.     vAxisOnly                    = 2
  1597. };
  1598.  
  1599. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1600. /*    • Control Creation/Deletion                                                            */
  1601. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1602. EXTERN_API( ControlHandle )
  1603. NewControl                        (WindowPtr                 owningWindow,
  1604.                                  const Rect *            boundsRect,
  1605.                                  ConstStr255Param         controlTitle,
  1606.                                  Boolean                 initiallyVisible,
  1607.                                  SInt16                 initialValue,
  1608.                                  SInt16                 minimumValue,
  1609.                                  SInt16                 maximumValue,
  1610.                                  SInt16                 procID,
  1611.                                  SInt32                 controlReference)                    ONEWORDINLINE(0xA954);
  1612.  
  1613. EXTERN_API( ControlHandle )
  1614. GetNewControl                    (SInt16                 resourceID,
  1615.                                  WindowPtr                 owningWindow)                        ONEWORDINLINE(0xA9BE);
  1616.  
  1617. EXTERN_API( void )
  1618. DisposeControl                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA955);
  1619.  
  1620. EXTERN_API( void )
  1621. KillControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA956);
  1622.  
  1623. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1624. /*    • Control Visible State                                                                */
  1625. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1626. EXTERN_API( void )
  1627. HiliteControl                    (ControlHandle             theControl,
  1628.                                  ControlPartCode         hiliteState)                        ONEWORDINLINE(0xA95D);
  1629.  
  1630. EXTERN_API( void )
  1631. ShowControl                        (ControlHandle             theControl)                            ONEWORDINLINE(0xA957);
  1632.  
  1633. EXTERN_API( void )
  1634. HideControl                        (ControlHandle             theControl)                            ONEWORDINLINE(0xA958);
  1635.  
  1636.  
  1637. /* following state routines available only with Appearance 1.0 and later*/
  1638. EXTERN_API( Boolean )
  1639. IsControlActive                    (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0005, 0xAA73);
  1640.  
  1641. EXTERN_API( Boolean )
  1642. IsControlVisible                (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0006, 0xAA73);
  1643.  
  1644. EXTERN_API( OSErr )
  1645. ActivateControl                    (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0007, 0xAA73);
  1646.  
  1647. EXTERN_API( OSErr )
  1648. DeactivateControl                (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0008, 0xAA73);
  1649.  
  1650. EXTERN_API( OSErr )
  1651. SetControlVisibility            (ControlHandle             inControl,
  1652.                                  Boolean                 inIsVisible,
  1653.                                  Boolean                 inDoDraw)                            THREEWORDINLINE(0x303C, 0x001E, 0xAA73);
  1654.  
  1655.  
  1656. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1657. /*    • Control Imaging                                                                    */
  1658. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1659. EXTERN_API( void )
  1660. DrawControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA969);
  1661.  
  1662. EXTERN_API( void )
  1663. Draw1Control                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA96D);
  1664.  
  1665. #define DrawOneControl(theControl) Draw1Control(theControl)
  1666.  
  1667. EXTERN_API( void )
  1668. UpdateControls                    (WindowPtr                 theWindow,
  1669.                                  RgnHandle                 updateRegion)                        ONEWORDINLINE(0xA953);
  1670.  
  1671.  
  1672. /* following imaging routines available only with Appearance 1.0 and later*/
  1673. EXTERN_API( OSErr )
  1674. GetBestControlRect                (ControlHandle             inControl,
  1675.                                  Rect *                    outRect,
  1676.                                  SInt16 *                outBaseLineOffset)                    THREEWORDINLINE(0x303C, 0x001B, 0xAA73);
  1677.  
  1678. EXTERN_API( OSErr )
  1679. SetControlFontStyle                (ControlHandle             inControl,
  1680.                                  const ControlFontStyleRec * inStyle)                        THREEWORDINLINE(0x303C, 0x001C, 0xAA73);
  1681.  
  1682. EXTERN_API( void )
  1683. DrawControlInCurrentPort        (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0018, 0xAA73);
  1684.  
  1685. EXTERN_API( OSErr )
  1686. SetUpControlBackground            (ControlHandle             inControl,
  1687.                                  SInt16                 inDepth,
  1688.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x001D, 0xAA73);
  1689.  
  1690. /* SetUpControlTextColor is available in Appearance 1.1 or later.*/
  1691. EXTERN_API( OSErr )
  1692. SetUpControlTextColor            (ControlHandle             inControl,
  1693.                                  SInt16                 inDepth,
  1694.                                  Boolean                 inIsColorDevice);
  1695.  
  1696.  
  1697. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1698. /*    • Control Mousing                                                                    */
  1699. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1700. /*
  1701.     NOTE ON CONTROL ACTION PROCS
  1702.  
  1703.     When using the TrackControl() call when tracking an indicator, the actionProc parameter
  1704.     (type ControlActionUPP) should be replaced by a parameter of type DragGrayRgnUPP
  1705.     (see Quickdraw.h).
  1706.  
  1707.     If, however, you are using the live feedback variants of scroll bars or sliders, you
  1708.     can pass a ControlActionUPP in when tracking the indicator as well. This functionality
  1709.     is available in Appearance 1.0 or later.
  1710. */
  1711. EXTERN_API( ControlPartCode )
  1712. TrackControl                    (ControlHandle             theControl,
  1713.                                  Point                     startPoint,
  1714.                                  ControlActionUPP         actionProc) /* can be NULL */        ONEWORDINLINE(0xA968);
  1715.  
  1716. EXTERN_API( void )
  1717. DragControl                        (ControlHandle             theControl,
  1718.                                  Point                     startPoint,
  1719.                                  const Rect *            limitRect,
  1720.                                  const Rect *            slopRect,
  1721.                                  DragConstraint         axis)                                ONEWORDINLINE(0xA967);
  1722.  
  1723. EXTERN_API( ControlPartCode )
  1724. TestControl                        (ControlHandle             theControl,
  1725.                                  Point                     testPoint)                            ONEWORDINLINE(0xA966);
  1726.  
  1727. EXTERN_API( ControlPartCode )
  1728. FindControl                        (Point                     testPoint,
  1729.                                  WindowPtr                 theWindow,
  1730.                                  ControlHandle *        theControl)                            ONEWORDINLINE(0xA96C);
  1731.  
  1732. /* The following mousing routines available only with Appearance 1.0 and later    */
  1733. /*                                                                                */
  1734. /* FindControlUnderMouse is preferrable to TrackControl when running under        */
  1735. /* Appearance 1.0 as you can pass in modifiers, which some of the new controls    */
  1736. /* use, such as edit text and list boxes.                                        */
  1737. EXTERN_API( ControlHandle )
  1738. FindControlUnderMouse            (Point                     inWhere,
  1739.                                  WindowPtr                 inWindow,
  1740.                                  SInt16 *                outPart)                            THREEWORDINLINE(0x303C, 0x0009, 0xAA73);
  1741.  
  1742. EXTERN_API( ControlPartCode )
  1743. HandleControlClick                (ControlHandle             inControl,
  1744.                                  Point                     inWhere,
  1745.                                  SInt16                 inModifiers,
  1746.                                  ControlActionUPP         inAction) /* can be NULL */            THREEWORDINLINE(0x303C, 0x000A, 0xAA73);
  1747.  
  1748.  
  1749.  
  1750.  
  1751. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1752. /*    • Control Events (available only with Appearance 1.0 and later)                        */
  1753. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1754. EXTERN_API( SInt16 )
  1755. HandleControlKey                (ControlHandle             inControl,
  1756.                                  SInt16                 inKeyCode,
  1757.                                  SInt16                 inCharCode,
  1758.                                  SInt16                 inModifiers)                        THREEWORDINLINE(0x303C, 0x000B, 0xAA73);
  1759.  
  1760. EXTERN_API( void )
  1761. IdleControls                    (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000C, 0xAA73);
  1762.  
  1763.  
  1764.  
  1765. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1766. /*    • Control Positioning                                                                */
  1767. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1768. EXTERN_API( void )
  1769. MoveControl                        (ControlHandle             theControl,
  1770.                                  SInt16                 h,
  1771.                                  SInt16                 v)                                    ONEWORDINLINE(0xA959);
  1772.  
  1773. EXTERN_API( void )
  1774. SizeControl                        (ControlHandle             theControl,
  1775.                                  SInt16                 w,
  1776.                                  SInt16                 h)                                    ONEWORDINLINE(0xA95C);
  1777.  
  1778. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1779. /*    • Control Title                                                                        */
  1780. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1781. EXTERN_API( void )
  1782. SetControlTitle                    (ControlHandle             theControl,
  1783.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA95F);
  1784.  
  1785. EXTERN_API( void )
  1786. GetControlTitle                    (ControlHandle             theControl,
  1787.                                  Str255                 title)                                ONEWORDINLINE(0xA95E);
  1788.  
  1789. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1790. /*    • Control Value                                                                        */
  1791. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1792. EXTERN_API( SInt16 )
  1793. GetControlValue                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA960);
  1794.  
  1795. EXTERN_API( void )
  1796. SetControlValue                    (ControlHandle             theControl,
  1797.                                  SInt16                 newValue)                            ONEWORDINLINE(0xA963);
  1798.  
  1799. EXTERN_API( SInt16 )
  1800. GetControlMinimum                (ControlHandle             theControl)                            ONEWORDINLINE(0xA961);
  1801.  
  1802. EXTERN_API( void )
  1803. SetControlMinimum                (ControlHandle             theControl,
  1804.                                  SInt16                 newMinimum)                            ONEWORDINLINE(0xA964);
  1805.  
  1806. EXTERN_API( SInt16 )
  1807. GetControlMaximum                (ControlHandle             theControl)                            ONEWORDINLINE(0xA962);
  1808.  
  1809. EXTERN_API( void )
  1810. SetControlMaximum                (ControlHandle             theControl,
  1811.                                  SInt16                 newMaximum)                            ONEWORDINLINE(0xA965);
  1812.  
  1813.  
  1814. /* proportional scrolling/32-bit value support is new with Appearance 1.1*/
  1815.  
  1816. EXTERN_API( SInt32 )
  1817. GetControlViewSize                (ControlHandle             theControl);
  1818.  
  1819. EXTERN_API( void )
  1820. SetControlViewSize                (ControlHandle             theControl,
  1821.                                  SInt32                 newViewSize);
  1822.  
  1823. EXTERN_API( SInt32 )
  1824. GetControl32BitValue            (ControlHandle             theControl);
  1825.  
  1826. EXTERN_API( void )
  1827. SetControl32BitValue            (ControlHandle             theControl,
  1828.                                  SInt32                 newValue);
  1829.  
  1830. EXTERN_API( SInt32 )
  1831. GetControl32BitMaximum            (ControlHandle             theControl);
  1832.  
  1833. EXTERN_API( void )
  1834. SetControl32BitMaximum            (ControlHandle             theControl,
  1835.                                  SInt32                 newMaximum);
  1836.  
  1837. EXTERN_API( SInt32 )
  1838. GetControl32BitMinimum            (ControlHandle             theControl);
  1839.  
  1840. EXTERN_API( void )
  1841. SetControl32BitMinimum            (ControlHandle             theControl,
  1842.                                  SInt32                 newMinimum);
  1843.  
  1844. /*
  1845.        IsValidControlHandle will tell you if the handle you pass in belongs to a control
  1846.       the Control Manager knows about. It does not sanity check the data in the control.
  1847. */
  1848.  
  1849. EXTERN_API( Boolean )
  1850. IsValidControlHandle            (ControlHandle             theControl);
  1851.  
  1852. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1853. /* • Properties                                                                            */
  1854. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1855. EXTERN_API( OSStatus )
  1856. GetControlProperty                (ControlHandle             control,
  1857.                                  OSType                 propertyCreator,
  1858.                                  OSType                 propertyTag,
  1859.                                  UInt32                 bufferSize,
  1860.                                  UInt32 *                actualSize,
  1861.                                  void *                    propertyBuffer);
  1862.  
  1863. EXTERN_API( OSStatus )
  1864. GetControlPropertySize            (ControlHandle             control,
  1865.                                  OSType                 propertyCreator,
  1866.                                  OSType                 propertyTag,
  1867.                                  UInt32 *                size);
  1868.  
  1869. EXTERN_API( OSStatus )
  1870. SetControlProperty                (ControlHandle             control,
  1871.                                  OSType                 propertyCreator,
  1872.                                  OSType                 propertyTag,
  1873.                                  UInt32                 propertySize,
  1874.                                  void *                    propertyData);
  1875.  
  1876. EXTERN_API( OSStatus )
  1877. RemoveControlProperty            (ControlHandle             control,
  1878.                                  OSType                 propertyCreator,
  1879.                                  OSType                 propertyTag);
  1880.  
  1881.  
  1882. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1883. /*    • Control Regions (Appearance 1.1 or later)                                            */
  1884. /*                                                                                        */
  1885. /*    See the discussion on meta-parts in this header for more information                */
  1886. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1887. EXTERN_API( OSStatus )
  1888. GetControlRegion                (ControlHandle             inControl,
  1889.                                  ControlPartCode         inPart,
  1890.                                  RgnHandle                 outRegion);
  1891.  
  1892.  
  1893.  
  1894. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1895. /*    • Control Variant                                                                    */
  1896. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1897. EXTERN_API( ControlVariant )
  1898. GetControlVariant                (ControlHandle             theControl)                            ONEWORDINLINE(0xA809);
  1899.  
  1900. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1901. /*    • Control Action                                                                    */
  1902. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1903. EXTERN_API( void )
  1904. SetControlAction                (ControlHandle             theControl,
  1905.                                  ControlActionUPP         actionProc)                            ONEWORDINLINE(0xA96B);
  1906.  
  1907. EXTERN_API( ControlActionUPP )
  1908. GetControlAction                (ControlHandle             theControl)                            ONEWORDINLINE(0xA96A);
  1909.  
  1910. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1911. /* • Control Accessors                                                                    */
  1912. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1913. EXTERN_API( void )
  1914. SetControlReference                (ControlHandle             theControl,
  1915.                                  SInt32                 data)                                ONEWORDINLINE(0xA95B);
  1916.  
  1917. EXTERN_API( SInt32 )
  1918. GetControlReference                (ControlHandle             theControl)                            ONEWORDINLINE(0xA95A);
  1919.  
  1920. EXTERN_API( Boolean )
  1921. GetAuxiliaryControlRecord        (ControlHandle             theControl,
  1922.                                  AuxCtlHandle *            acHndl)                                ONEWORDINLINE(0xAA44);
  1923.  
  1924. EXTERN_API( void )
  1925. SetControlColor                    (ControlHandle             theControl,
  1926.                                  CCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA43);
  1927.  
  1928. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1929. /*    • HELPERS (available only with Appearance 1.0 and later)                            */
  1930. /*                                                                                        */
  1931. /* These routines are available only thru the shared library/glue                        */
  1932. /* Bevel button routines                                                                */
  1933. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1934.  
  1935. EXTERN_API( OSErr )
  1936. GetBevelButtonMenuValue            (ControlHandle             inButton,
  1937.                                  SInt16 *                outValue);
  1938.  
  1939. EXTERN_API( OSErr )
  1940. SetBevelButtonMenuValue            (ControlHandle             inButton,
  1941.                                  SInt16                 inValue);
  1942.  
  1943. EXTERN_API( OSErr )
  1944. GetBevelButtonMenuHandle        (ControlHandle             inButton,
  1945.                                  MenuHandle *            outHandle);
  1946.  
  1947. EXTERN_API( OSErr )
  1948. GetBevelButtonContentInfo        (ControlHandle             inButton,
  1949.                                  ControlButtonContentInfoPtr  outContent);
  1950.  
  1951. EXTERN_API( OSErr )
  1952. SetBevelButtonContentInfo        (ControlHandle             inButton,
  1953.                                  ControlButtonContentInfoPtr  inContent);
  1954.  
  1955. EXTERN_API( OSErr )
  1956. SetBevelButtonTransform            (ControlHandle             inButton,
  1957.                                  IconTransformType         transform);
  1958.  
  1959. EXTERN_API( OSErr )
  1960. SetBevelButtonGraphicAlignment    (ControlHandle             inButton,
  1961.                                  ControlButtonGraphicAlignment  inAlign,
  1962.                                  SInt16                 inHOffset,
  1963.                                  SInt16                 inVOffset);
  1964.  
  1965. EXTERN_API( OSErr )
  1966. SetBevelButtonTextAlignment        (ControlHandle             inButton,
  1967.                                  ControlButtonTextAlignment  inAlign,
  1968.                                  SInt16                 inHOffset);
  1969.  
  1970. EXTERN_API( OSErr )
  1971. SetBevelButtonTextPlacement        (ControlHandle             inButton,
  1972.                                  ControlButtonTextPlacement  inWhere);
  1973.  
  1974. /* Image well routines*/
  1975.  
  1976. EXTERN_API( OSErr )
  1977. GetImageWellContentInfo            (ControlHandle             inButton,
  1978.                                  ControlButtonContentInfoPtr  outContent);
  1979.  
  1980. EXTERN_API( OSErr )
  1981. SetImageWellContentInfo            (ControlHandle             inButton,
  1982.                                  ControlButtonContentInfoPtr  inContent);
  1983.  
  1984. EXTERN_API( OSErr )
  1985. SetImageWellTransform            (ControlHandle             inButton,
  1986.                                  IconTransformType         inTransform);
  1987.  
  1988. /* Tab routines*/
  1989.  
  1990. EXTERN_API( OSErr )
  1991. GetTabContentRect                (ControlHandle             inTabControl,
  1992.                                  Rect *                    outContentRect);
  1993.  
  1994. EXTERN_API( OSErr )
  1995. SetTabEnabled                    (ControlHandle             inTabControl,
  1996.                                  SInt16                 inTabToHilite,
  1997.                                  Boolean                 inEnabled);
  1998.  
  1999. /* Disclosure triangles*/
  2000.  
  2001. EXTERN_API( OSErr )
  2002. SetDisclosureTriangleLastValue    (ControlHandle             inTabControl,
  2003.                                  SInt16                 inValue);
  2004.  
  2005. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2006. /*    • Control Hierarchy (Appearance 1.0 and later only)                                    */
  2007. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2008. EXTERN_API( SInt32 )
  2009. SendControlMessage                (ControlHandle             inControl,
  2010.                                  SInt16                 inMessage,
  2011.                                  SInt32                 inParam)                            THREEWORDINLINE(0x303C, 0xFFFE, 0xAA73);
  2012.  
  2013. EXTERN_API( OSErr )
  2014. DumpControlHierarchy            (WindowPtr                 inWindow,
  2015.                                  const FSSpec *            inDumpFile)                            THREEWORDINLINE(0x303C, 0xFFFF, 0xAA73);
  2016.  
  2017. EXTERN_API( OSErr )
  2018. CreateRootControl                (WindowPtr                 inWindow,
  2019.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x0001, 0xAA73);
  2020.  
  2021. EXTERN_API( OSErr )
  2022. GetRootControl                    (WindowPtr                 inWindow,
  2023.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x0002, 0xAA73);
  2024.  
  2025. EXTERN_API( OSErr )
  2026. EmbedControl                    (ControlHandle             inControl,
  2027.                                  ControlHandle             inContainer)                        THREEWORDINLINE(0x303C, 0x0003, 0xAA73);
  2028.  
  2029. EXTERN_API( OSErr )
  2030. AutoEmbedControl                (ControlHandle             inControl,
  2031.                                  WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0004, 0xAA73);
  2032.  
  2033. EXTERN_API( OSErr )
  2034. GetSuperControl                    (ControlHandle             inControl,
  2035.                                  ControlHandle *        outParent)                            THREEWORDINLINE(0x303C, 0x0015, 0xAA73);
  2036.  
  2037. EXTERN_API( OSErr )
  2038. CountSubControls                (ControlHandle             inControl,
  2039.                                  UInt16 *                outNumChildren)                        THREEWORDINLINE(0x303C, 0x0016, 0xAA73);
  2040.  
  2041. EXTERN_API( OSErr )
  2042. GetIndexedSubControl            (ControlHandle             inControl,
  2043.                                  UInt16                 inIndex,
  2044.                                  ControlHandle *        outSubControl)                        THREEWORDINLINE(0x303C, 0x0017, 0xAA73);
  2045.  
  2046. EXTERN_API( OSErr )
  2047. SetControlSupervisor            (ControlHandle             inControl,
  2048.                                  ControlHandle             inBoss)                                THREEWORDINLINE(0x303C, 0x001A, 0xAA73);
  2049.  
  2050.  
  2051.  
  2052. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2053. /*    • Keyboard Focus (available only with Appearance 1.0 and later)                        */
  2054. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2055. EXTERN_API( OSErr )
  2056. GetKeyboardFocus                (WindowPtr                 inWindow,
  2057.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x000D, 0xAA73);
  2058.  
  2059. EXTERN_API( OSErr )
  2060. SetKeyboardFocus                (WindowPtr                 inWindow,
  2061.                                  ControlHandle             inControl,
  2062.                                  ControlFocusPart         inPart)                                THREEWORDINLINE(0x303C, 0x000E, 0xAA73);
  2063.  
  2064. EXTERN_API( OSErr )
  2065. AdvanceKeyboardFocus            (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000F, 0xAA73);
  2066.  
  2067. EXTERN_API( OSErr )
  2068. ReverseKeyboardFocus            (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0010, 0xAA73);
  2069.  
  2070. EXTERN_API( OSErr )
  2071. ClearKeyboardFocus                (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0019, 0xAA73);
  2072.  
  2073.  
  2074.  
  2075. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2076. /*    • Control Data (available only with Appearance 1.0 and later)                        */
  2077. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2078.  
  2079. EXTERN_API( OSErr )
  2080. GetControlFeatures                (ControlHandle             inControl,
  2081.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0011, 0xAA73);
  2082.  
  2083. EXTERN_API( OSErr )
  2084. SetControlData                    (ControlHandle             inControl,
  2085.                                  ControlPartCode         inPart,
  2086.                                  ResType                 inTagName,
  2087.                                  Size                     inSize,
  2088.                                  Ptr                     inData)                                THREEWORDINLINE(0x303C, 0x0012, 0xAA73);
  2089.  
  2090. EXTERN_API( OSErr )
  2091. GetControlData                    (ControlHandle             inControl,
  2092.                                  ControlPartCode         inPart,
  2093.                                  ResType                 inTagName,
  2094.                                  Size                     inBufferSize,
  2095.                                  Ptr                     inBuffer,
  2096.                                  Size *                    outActualSize)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA73);
  2097.  
  2098. EXTERN_API( OSErr )
  2099. GetControlDataSize                (ControlHandle             inControl,
  2100.                                  ControlPartCode         inPart,
  2101.                                  ResType                 inTagName,
  2102.                                  Size *                    outMaxSize)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA73);
  2103.  
  2104.  
  2105.  
  2106.  
  2107. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2108. /*    • ‘CDEF’ messages                                                                    */
  2109. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2110. typedef SInt16                             ControlDefProcMessage;
  2111.  
  2112. enum {
  2113.     drawCntl                    = 0,
  2114.     testCntl                    = 1,
  2115.     calcCRgns                    = 2,
  2116.     initCntl                    = 3,
  2117.     dispCntl                    = 4,
  2118.     posCntl                        = 5,
  2119.     thumbCntl                    = 6,
  2120.     dragCntl                    = 7,
  2121.     autoTrack                    = 8,
  2122.     calcCntlRgn                    = 10,
  2123.     calcThumbRgn                = 11,
  2124.     drawThumbOutline            = 12
  2125. };
  2126.  
  2127. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2128. /*    • ‘CDEF’ entrypoint                                                                    */
  2129. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2130. typedef CALLBACK_API( SInt32 , ControlDefProcPtr )(SInt16 varCode, ControlHandle theControl, ControlDefProcMessage message, SInt32 param);
  2131. typedef STACK_UPP_TYPE(ControlDefProcPtr)                         ControlDefUPP;
  2132. enum { uppControlDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  2133. #define NewControlDefProc(userRoutine)                             (ControlDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlDefProcInfo, GetCurrentArchitecture())
  2134. #define CallControlDefProc(userRoutine, varCode, theControl, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlDefProcInfo, (varCode), (theControl), (message), (param))
  2135. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2136. /*    • Constants for drawCntl message (passed in param)                                    */
  2137. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2138.  
  2139. enum {
  2140.     kDrawControlEntireControl    = 0,
  2141.     kDrawControlIndicatorOnly    = 129
  2142. };
  2143.  
  2144. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2145. /*    • Constants for dragCntl message (passed in param)                                    */
  2146. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2147.  
  2148. enum {
  2149.     kDragControlEntireControl    = 0,
  2150.     kDragControlIndicator        = 1
  2151. };
  2152.  
  2153. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2154. /*    • Drag Constraint Structure for thumbCntl message (passed in param)                    */
  2155. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2156.  
  2157. struct IndicatorDragConstraint {
  2158.     Rect                             limitRect;
  2159.     Rect                             slopRect;
  2160.     DragConstraint                     axis;
  2161. };
  2162. typedef struct IndicatorDragConstraint    IndicatorDragConstraint;
  2163. typedef IndicatorDragConstraint *        IndicatorDragConstraintPtr;
  2164. typedef IndicatorDragConstraintPtr *    IndicatorDragConstraintHandle;
  2165. #if !TARGET_OS_MAC
  2166. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2167. /*    • QuickTime 3.0 Win32/unix notification    mechanism                                    */
  2168. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2169. /* Proc used to notify window that something happened to the control*/
  2170. typedef CALLBACK_API_C( void , ControlNotificationProcPtr )(WindowPtr theWindow, ControlHandle theControl, ControlNotification notification, long param1, long param2);
  2171. /*
  2172.    Proc used to prefilter events before handled by control.  A client of a control calls
  2173.    CTRLSetPreFilterProc() to have the control call this proc before handling the event.
  2174.    If the proc returns TRUE, the control can go ahead and handle the event.
  2175. */
  2176. typedef CALLBACK_API_C( Boolean , PreFilterEventProc )(ControlHandle theControl, EventRecord *theEvent);
  2177. EXTERN_API_C( long )
  2178. GetControlComponentInstance        (ControlHandle             theControl);
  2179.  
  2180. EXTERN_API_C( ControlHandle )
  2181. GetControlHandleFromCookie        (long                     cookie);
  2182.  
  2183. EXTERN_API_C( void )
  2184. SetControlDefProc                (short                     resID,
  2185.                                  ControlDefProcPtr         proc);
  2186.  
  2187. #endif  /* !TARGET_OS_MAC */
  2188.  
  2189. #if CGLUESUPPORTED
  2190. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2191. /*    • C Glue                                                                            */
  2192. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2193. EXTERN_API_C( void )
  2194. dragcontrol                        (ControlHandle             theControl,
  2195.                                  Point *                startPt,
  2196.                                  const Rect *            limitRect,
  2197.                                  const Rect *            slopRect,
  2198.                                  short                     axis);
  2199.  
  2200. EXTERN_API_C( ControlHandle )
  2201. newcontrol                        (WindowPtr                 theWindow,
  2202.                                  const Rect *            boundsRect,
  2203.                                  const char *            title,
  2204.                                  Boolean                 visible,
  2205.                                  short                     value,
  2206.                                  short                     min,
  2207.                                  short                     max,
  2208.                                  short                     procID,
  2209.                                  long                     refCon);
  2210.  
  2211. EXTERN_API_C( short )
  2212. findcontrol                        (Point *                thePoint,
  2213.                                  WindowPtr                 theWindow,
  2214.                                  ControlHandle *        theControl);
  2215.  
  2216. EXTERN_API_C( void )
  2217. getcontroltitle                    (ControlHandle             theControl,
  2218.                                  char *                    title);
  2219.  
  2220. EXTERN_API_C( void )
  2221. setcontroltitle                    (ControlHandle             theControl,
  2222.                                  const char *            title);
  2223.  
  2224. EXTERN_API_C( short )
  2225. trackcontrol                    (ControlHandle             theControl,
  2226.                                  Point *                thePoint,
  2227.                                  ControlActionUPP         actionProc);
  2228.  
  2229. EXTERN_API_C( short )
  2230. testcontrol                        (ControlHandle             theControl,
  2231.                                  Point *                thePt);
  2232.  
  2233. #endif  /* CGLUESUPPORTED */
  2234.  
  2235. #if OLDROUTINENAMES
  2236. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2237. /*    • OLDROUTINENAMES                                                                    */
  2238. /*——————————————————————————————————————————————————————————————————————————————————————*/
  2239. /* Variants applicable to all controls (at least ones with text)*/
  2240.  
  2241. enum {
  2242.     useWFont                    = popupUseWFont
  2243. };
  2244.  
  2245.  
  2246. enum {
  2247.     kControlCheckboxUncheckedValue = kControlCheckBoxUncheckedValue,
  2248.     kControlCheckboxCheckedValue = kControlCheckBoxCheckedValue,
  2249.     kControlCheckboxMixedValue    = kControlCheckBoxMixedValue
  2250. };
  2251.  
  2252.  
  2253. enum {
  2254.     inLabel                        = kControlLabelPart,
  2255.     inMenu                        = kControlMenuPart,
  2256.     inTriangle                    = kControlTrianglePart,
  2257.     inButton                    = kControlButtonPart,
  2258.     inCheckBox                    = kControlCheckBoxPart,
  2259.     inUpButton                    = kControlUpButtonPart,
  2260.     inDownButton                = kControlDownButtonPart,
  2261.     inPageUp                    = kControlPageUpPart,
  2262.     inPageDown                    = kControlPageDownPart,
  2263.     inThumb                        = kControlIndicatorPart
  2264. };
  2265.  
  2266.  
  2267. enum {
  2268.     kNoHiliteControlPart        = kControlNoPart,
  2269.     kInLabelControlPart            = kControlLabelPart,
  2270.     kInMenuControlPart            = kControlMenuPart,
  2271.     kInTriangleControlPart        = kControlTrianglePart,
  2272.     kInButtonControlPart        = kControlButtonPart,
  2273.     kInCheckBoxControlPart        = kControlCheckBoxPart,
  2274.     kInUpButtonControlPart        = kControlUpButtonPart,
  2275.     kInDownButtonControlPart    = kControlDownButtonPart,
  2276.     kInPageUpControlPart        = kControlPageUpPart,
  2277.     kInPageDownControlPart        = kControlPageDownPart,
  2278.     kInIndicatorControlPart        = kControlIndicatorPart,
  2279.     kReservedControlPart        = kControlDisabledPart,
  2280.     kControlInactiveControlPart    = kControlInactivePart
  2281. };
  2282.  
  2283. #define SetCTitle(theControl, title) SetControlTitle(theControl, title)
  2284. #define GetCTitle(theControl, title) GetControlTitle(theControl, title)
  2285. #define UpdtControl(theWindow, updateRgn) UpdateControls(theWindow, updateRgn)
  2286. #define SetCtlValue(theControl, theValue) SetControlValue(theControl, theValue)
  2287. #define GetCtlValue(theControl) GetControlValue(theControl)
  2288. #define SetCtlMin(theControl, minValue) SetControlMinimum(theControl, minValue)
  2289. #define GetCtlMin(theControl) GetControlMinimum(theControl)
  2290. #define SetCtlMax(theControl, maxValue) SetControlMaximum(theControl, maxValue)
  2291. #define GetCtlMax(theControl) GetControlMaximum(theControl)
  2292. #define GetAuxCtl(theControl, acHndl) GetAuxiliaryControlRecord(theControl, acHndl)
  2293. #define SetCRefCon(theControl, data) SetControlReference(theControl, data)
  2294. #define GetCRefCon(theControl) GetControlReference(theControl)
  2295. #define SetCtlAction(theControl, actionProc) SetControlAction(theControl, actionProc)
  2296. #define GetCtlAction(theControl) GetControlAction(theControl)
  2297. #define SetCtlColor(theControl, newColorTable) SetControlColor(theControl, newColorTable)
  2298. #define GetCVariant(theControl) GetControlVariant(theControl)
  2299. #define getctitle(theControl, title) getcontroltitle(theControl, title)
  2300. #define setctitle(theControl, title) setcontroltitle(theControl, title)
  2301. #endif  /* OLDROUTINENAMES */
  2302.  
  2303. #define GetControlListFromWindow(theWindow)        ( *(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  2304. #define GetControlOwningWindowControlList(theWindow)        ( *(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312. #if PRAGMA_STRUCT_ALIGN
  2313.     #pragma options align=reset
  2314. #elif PRAGMA_STRUCT_PACKPUSH
  2315.     #pragma pack(pop)
  2316. #elif PRAGMA_STRUCT_PACK
  2317.     #pragma pack()
  2318. #endif
  2319.  
  2320. #ifdef PRAGMA_IMPORT_OFF
  2321. #pragma import off
  2322. #elif PRAGMA_IMPORT
  2323. #pragma import reset
  2324. #endif
  2325.  
  2326. #ifdef __cplusplus
  2327. }
  2328. #endif
  2329.  
  2330. #endif /* __CONTROLS__ */
  2331.  
  2332.