Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3526 lines
127 KiB

  1. /*
  2. File: Controls.h
  3. Contains: Control Manager interfaces
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1985-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __CONTROLS__
  11. #define __CONTROLS__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __QUICKDRAW__
  16. #include <Quickdraw.h>
  17. #endif
  18. #ifndef __COLLECTIONS__
  19. #include <Collections.h>
  20. #endif
  21. #ifndef __MACERRORS__
  22. #include <MacErrors.h>
  23. #endif
  24. #ifndef __CFSTRING__
  25. #include <CFString.h>
  26. #endif
  27. #ifndef __ICONS__
  28. #include <Icons.h>
  29. #endif
  30. #ifndef __HIOBJECT__
  31. #include <HIObject.h>
  32. #endif
  33. #ifndef __MENUS__
  34. #include <Menus.h>
  35. #endif
  36. #ifndef __TEXTEDIT__
  37. #include <TextEdit.h>
  38. #endif
  39. #ifndef __DRAG__
  40. #include <Drag.h>
  41. #endif
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. #if PRAGMA_IMPORT
  49. #pragma import on
  50. #endif
  51. #if PRAGMA_STRUCT_ALIGN
  52. #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54. #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56. #pragma pack(2)
  57. #endif
  58. /*------------------------------------------------------------------------------------------------------*/
  59. /* o Resource Types */
  60. /*------------------------------------------------------------------------------------------------------*/
  61. enum {
  62. kControlDefProcType = FOUR_CHAR_CODE('CDEF'),
  63. kControlTemplateResourceType = FOUR_CHAR_CODE('CNTL'),
  64. kControlColorTableResourceType = FOUR_CHAR_CODE('cctb'),
  65. kControlDefProcResourceType = FOUR_CHAR_CODE('CDEF')
  66. };
  67. /*------------------------------------------------------------------------------------------------------*/
  68. /* o Format of a 'CNTL' resource */
  69. /*------------------------------------------------------------------------------------------------------*/
  70. struct ControlTemplate {
  71. Rect controlRect;
  72. SInt16 controlValue;
  73. Boolean controlVisible;
  74. UInt8 fill;
  75. SInt16 controlMaximum;
  76. SInt16 controlMinimum;
  77. SInt16 controlDefProcID;
  78. SInt32 controlReference;
  79. Str255 controlTitle;
  80. };
  81. typedef struct ControlTemplate ControlTemplate;
  82. typedef ControlTemplate * ControlTemplatePtr;
  83. typedef ControlTemplatePtr * ControlTemplateHandle;
  84. #if !TARGET_OS_MAC
  85. /*
  86. ---------------------------------------------------------------------------------------------------------
  87. o NON-MAC COMPATIBILITY CODES (QuickTime 3.0)
  88. ---------------------------------------------------------------------------------------------------------
  89. */
  90. typedef UInt32 ControlNotification;
  91. enum {
  92. controlNotifyNothing = FOUR_CHAR_CODE('nada'), /* No (null) notification*/
  93. controlNotifyClick = FOUR_CHAR_CODE('clik'), /* Control was clicked*/
  94. controlNotifyFocus = FOUR_CHAR_CODE('focu'), /* Control got keyboard focus*/
  95. controlNotifyKey = FOUR_CHAR_CODE('key ') /* Control got a keypress*/
  96. };
  97. typedef UInt32 ControlCapabilities;
  98. enum {
  99. kControlCanAutoInvalidate = 1L << 0 /* Control component automatically invalidates areas left behind after hide/move operation.*/
  100. };
  101. /* procID's for our added "controls"*/
  102. enum {
  103. staticTextProc = 256, /* static text*/
  104. editTextProc = 272, /* editable text*/
  105. iconProc = 288, /* icon*/
  106. userItemProc = 304, /* user drawn item*/
  107. pictItemProc = 320 /* pict*/
  108. };
  109. #endif /* !TARGET_OS_MAC */
  110. /*------------------------------------------------------------------------------------------------------*/
  111. /* o ControlRef */
  112. /*------------------------------------------------------------------------------------------------------*/
  113. #if !OPAQUE_TOOLBOX_STRUCTS
  114. typedef struct ControlRecord ControlRecord;
  115. typedef ControlRecord * ControlPtr;
  116. typedef ControlPtr * ControlRef;
  117. #else
  118. typedef struct OpaqueControlRef* ControlRef;
  119. #endif /* !OPAQUE_TOOLBOX_STRUCTS */
  120. /* ControlHandle is obsolete. Use ControlRef.*/
  121. typedef ControlRef ControlHandle;
  122. typedef SInt16 ControlPartCode;
  123. /*------------------------------------------------------------------------------------------------------*/
  124. /* o Control ActionProcPtr */
  125. /*------------------------------------------------------------------------------------------------------*/
  126. typedef CALLBACK_API( void , ControlActionProcPtr )(ControlRef theControl, ControlPartCode partCode);
  127. typedef STACK_UPP_TYPE(ControlActionProcPtr) ControlActionUPP;
  128. /*------------------------------------------------------------------------------------------------------*/
  129. /* o ControlRecord */
  130. /*------------------------------------------------------------------------------------------------------*/
  131. #if !OPAQUE_TOOLBOX_STRUCTS
  132. struct ControlRecord {
  133. ControlRef nextControl; /* in Carbon use embedding heirarchy functions*/
  134. WindowRef contrlOwner; /* in Carbon use GetControlOwner or EmbedControl*/
  135. Rect contrlRect; /* in Carbon use Get/SetControlBounds*/
  136. UInt8 contrlVis; /* in Carbon use IsControlVisible, SetControlVisibility*/
  137. UInt8 contrlHilite; /* in Carbon use GetControlHilite, HiliteControl*/
  138. SInt16 contrlValue; /* in Carbon use Get/SetControlValue, Get/SetControl32BitValue*/
  139. SInt16 contrlMin; /* in Carbon use Get/SetControlMinimum, Get/SetControl32BitMinimum*/
  140. SInt16 contrlMax; /* in Carbon use Get/SetControlMaximum, Get/SetControl32BitMaximum*/
  141. Handle contrlDefProc; /* not supported in Carbon*/
  142. Handle contrlData; /* in Carbon use Get/SetControlDataHandle*/
  143. ControlActionUPP contrlAction; /* in Carbon use Get/SetControlAction*/
  144. SInt32 contrlRfCon; /* in Carbon use Get/SetControlReference*/
  145. Str255 contrlTitle; /* in Carbon use Get/SetControlTitle*/
  146. };
  147. #endif /* !OPAQUE_TOOLBOX_STRUCTS */
  148. /*------------------------------------------------------------------------------------------------------*/
  149. /* o Control ActionProcPtr : Epilogue */
  150. /*------------------------------------------------------------------------------------------------------*/
  151. /*
  152. * NewControlActionUPP()
  153. *
  154. * Availability:
  155. * Non-Carbon CFM: available as macro/inline
  156. * CarbonLib: in CarbonLib 1.0 and later
  157. * Mac OS X: in version 10.0 and later
  158. */
  159. EXTERN_API_C( ControlActionUPP )
  160. NewControlActionUPP(ControlActionProcPtr userRoutine);
  161. #if !OPAQUE_UPP_TYPES
  162. enum { uppControlActionProcInfo = 0x000002C0 }; /* pascal no_return_value Func(4_bytes, 2_bytes) */
  163. #ifdef __cplusplus
  164. inline DEFINE_API_C(ControlActionUPP) NewControlActionUPP(ControlActionProcPtr userRoutine) { return (ControlActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlActionProcInfo, GetCurrentArchitecture()); }
  165. #else
  166. #define NewControlActionUPP(userRoutine) (ControlActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlActionProcInfo, GetCurrentArchitecture())
  167. #endif
  168. #endif
  169. /*
  170. * DisposeControlActionUPP()
  171. *
  172. * Availability:
  173. * Non-Carbon CFM: available as macro/inline
  174. * CarbonLib: in CarbonLib 1.0 and later
  175. * Mac OS X: in version 10.0 and later
  176. */
  177. EXTERN_API_C( void )
  178. DisposeControlActionUPP(ControlActionUPP userUPP);
  179. #if !OPAQUE_UPP_TYPES
  180. #ifdef __cplusplus
  181. inline DEFINE_API_C(void) DisposeControlActionUPP(ControlActionUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  182. #else
  183. #define DisposeControlActionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  184. #endif
  185. #endif
  186. /*
  187. * InvokeControlActionUPP()
  188. *
  189. * Availability:
  190. * Non-Carbon CFM: available as macro/inline
  191. * CarbonLib: in CarbonLib 1.0 and later
  192. * Mac OS X: in version 10.0 and later
  193. */
  194. EXTERN_API_C( void )
  195. InvokeControlActionUPP(
  196. ControlRef theControl,
  197. ControlPartCode partCode,
  198. ControlActionUPP userUPP);
  199. #if !OPAQUE_UPP_TYPES
  200. #ifdef __cplusplus
  201. inline DEFINE_API_C(void) InvokeControlActionUPP(ControlRef theControl, ControlPartCode partCode, ControlActionUPP userUPP) { CALL_TWO_PARAMETER_UPP(userUPP, uppControlActionProcInfo, theControl, partCode); }
  202. #else
  203. #define InvokeControlActionUPP(theControl, partCode, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppControlActionProcInfo, (theControl), (partCode))
  204. #endif
  205. #endif
  206. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  207. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  208. #define NewControlActionProc(userRoutine) NewControlActionUPP(userRoutine)
  209. #define CallControlActionProc(userRoutine, theControl, partCode) InvokeControlActionUPP(theControl, partCode, userRoutine)
  210. #endif /* CALL_NOT_IN_CARBON */
  211. /*------------------------------------------------------------------------------------------------------*/
  212. /* o Control Color Table */
  213. /*------------------------------------------------------------------------------------------------------*/
  214. enum {
  215. cFrameColor = 0,
  216. cBodyColor = 1,
  217. cTextColor = 2,
  218. cThumbColor = 3,
  219. kNumberCtlCTabEntries = 4
  220. };
  221. struct CtlCTab {
  222. SInt32 ccSeed;
  223. SInt16 ccRider;
  224. SInt16 ctSize;
  225. ColorSpec ctTable[4];
  226. };
  227. typedef struct CtlCTab CtlCTab;
  228. typedef CtlCTab * CCTabPtr;
  229. typedef CCTabPtr * CCTabHandle;
  230. /*------------------------------------------------------------------------------------------------------*/
  231. /* o Auxiliary Control Record */
  232. /*------------------------------------------------------------------------------------------------------*/
  233. #if !OPAQUE_TOOLBOX_STRUCTS
  234. struct AuxCtlRec {
  235. Handle acNext; /* not supported in Carbon*/
  236. ControlRef acOwner; /* not supported in Carbon*/
  237. CCTabHandle acCTable; /* not supported in Carbon*/
  238. SInt16 acFlags; /* not supported in Carbon*/
  239. SInt32 acReserved; /* not supported in Carbon*/
  240. SInt32 acRefCon; /* in Carbon use Get/SetControlProperty if you need more refCons*/
  241. };
  242. typedef struct AuxCtlRec AuxCtlRec;
  243. typedef AuxCtlRec * AuxCtlPtr;
  244. typedef AuxCtlPtr * AuxCtlHandle;
  245. #endif /* !OPAQUE_TOOLBOX_STRUCTS */
  246. /*--------------------------------------------------------------------------------------*/
  247. /* o Control Variants */
  248. /*--------------------------------------------------------------------------------------*/
  249. typedef SInt16 ControlVariant;
  250. enum {
  251. kControlNoVariant = 0, /* No variant*/
  252. kControlUsesOwningWindowsFontVariant = 1 << 3 /* Control uses owning windows font to display text*/
  253. };
  254. /*--------------------------------------------------------------------------------------*/
  255. /* o Control Part Codes */
  256. /*--------------------------------------------------------------------------------------*/
  257. /* Basic part codes */
  258. enum {
  259. kControlNoPart = 0,
  260. kControlIndicatorPart = 129,
  261. kControlDisabledPart = 254,
  262. kControlInactivePart = 255
  263. };
  264. /* Use this constant in Get/SetControlData when the data referred to is not */
  265. /* specific to a part, but rather the entire control, e.g. the list handle of a */
  266. /* list box control. */
  267. enum {
  268. kControlEntireControl = 0
  269. };
  270. /* Meta-Parts */
  271. /* */
  272. /* If you haven't guessed from looking at other toolbox headers. We like the word */
  273. /* 'meta'. It's cool. So here's one more for you. A meta-part is a part used in a call */
  274. /* to the GetControlRegion API. These parts are parts that might be defined by a */
  275. /* control, but should not be returned from calls like TestControl, et al. They define */
  276. /* a region of a control, presently the structure and the content region. The content */
  277. /* region is only defined by controls that can embed other controls. It is the area */
  278. /* that embedded content can live. */
  279. /* */
  280. /* Along with these parts, you can also pass in normal part codes to get the regions */
  281. /* of the parts. Not all controls fully support this at the time this was written. */
  282. enum {
  283. kControlStructureMetaPart = -1,
  284. kControlContentMetaPart = -2
  285. };
  286. /* focusing part codes */
  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. typedef SInt16 ControlFocusPart;
  293. /*------------------------------------------------------------------------------------------------------*/
  294. /* o Control Collection Tags */
  295. /*------------------------------------------------------------------------------------------------------*/
  296. /* These are standard tags that you will find in the initial data Collection that is passed in the */
  297. /* 'param' parameter to the initCntl message (Carbon only). */
  298. /* */
  299. /* All tags at ID zero in a Control's Collection are reserved for Control Manager use. */
  300. /* Custom control definitions should use other IDs. */
  301. /* */
  302. /* Most of these tags are interpreted when you call CreateCustomControl; the Control Manager will */
  303. /* put value in the right place before calling the Control Definition with the initialization message. */
  304. enum {
  305. kControlCollectionTagBounds = FOUR_CHAR_CODE('boun'), /* Rect - the bounding rectangle*/
  306. kControlCollectionTagValue = FOUR_CHAR_CODE('valu'), /* SInt32 - the value*/
  307. kControlCollectionTagMinimum = FOUR_CHAR_CODE('min '), /* SInt32 - the minimum*/
  308. kControlCollectionTagMaximum = FOUR_CHAR_CODE('max '), /* SInt32 - the maximum*/
  309. kControlCollectionTagViewSize = FOUR_CHAR_CODE('view'), /* SInt32 - the view size*/
  310. kControlCollectionTagVisibility = FOUR_CHAR_CODE('visi'), /* Boolean - the visible state*/
  311. kControlCollectionTagRefCon = FOUR_CHAR_CODE('refc'), /* SInt32 - the refCon*/
  312. kControlCollectionTagTitle = FOUR_CHAR_CODE('titl'), /* arbitrarily sized character array - the title*/
  313. kControlCollectionTagUnicodeTitle = FOUR_CHAR_CODE('uttl'), /* bytes as received via CFStringCreateExternalRepresentation*/
  314. kControlCollectionTagIDSignature = FOUR_CHAR_CODE('idsi'), /* OSType - the ControlID signature*/
  315. kControlCollectionTagIDID = FOUR_CHAR_CODE('idid'), /* SInt32 - the ControlID id*/
  316. kControlCollectionTagCommand = FOUR_CHAR_CODE('cmd '), /* UInt32 - the command*/
  317. kControlCollectionTagVarCode = FOUR_CHAR_CODE('varc') /* SInt16 - the variant*/
  318. };
  319. /*------------------------------------------------------------------------------------------------------*/
  320. /* o Control Image Content */
  321. /*------------------------------------------------------------------------------------------------------*/
  322. enum {
  323. kControlContentTextOnly = 0,
  324. kControlNoContent = 0,
  325. kControlContentIconSuiteRes = 1,
  326. kControlContentCIconRes = 2,
  327. kControlContentPictRes = 3,
  328. kControlContentICONRes = 4,
  329. kControlContentIconSuiteHandle = 129,
  330. kControlContentCIconHandle = 130,
  331. kControlContentPictHandle = 131,
  332. kControlContentIconRef = 132,
  333. kControlContentICON = 133
  334. };
  335. typedef SInt16 ControlContentType;
  336. struct ControlButtonContentInfo {
  337. ControlContentType contentType;
  338. union {
  339. SInt16 resID;
  340. CIconHandle cIconHandle;
  341. Handle iconSuite;
  342. IconRef iconRef;
  343. PicHandle picture;
  344. Handle ICONHandle;
  345. } u;
  346. };
  347. typedef struct ControlButtonContentInfo ControlButtonContentInfo;
  348. typedef ControlButtonContentInfo * ControlButtonContentInfoPtr;
  349. typedef ControlButtonContentInfo ControlImageContentInfo;
  350. typedef ControlButtonContentInfo * ControlImageContentInfoPtr;
  351. /*------------------------------------------------------------------------------------------------------*/
  352. /* o Control Key Script Behavior */
  353. /*------------------------------------------------------------------------------------------------------*/
  354. enum {
  355. kControlKeyScriptBehaviorAllowAnyScript = FOUR_CHAR_CODE('any '), /* leaves the current keyboard alone and allows user to change the keyboard.*/
  356. kControlKeyScriptBehaviorPrefersRoman = FOUR_CHAR_CODE('prmn'), /* switches the keyboard to roman, but allows them to change it as desired.*/
  357. kControlKeyScriptBehaviorRequiresRoman = FOUR_CHAR_CODE('rrmn') /* switches the keyboard to roman and prevents the user from changing it.*/
  358. };
  359. typedef UInt32 ControlKeyScriptBehavior;
  360. /*------------------------------------------------------------------------------------------------------*/
  361. /* o Control Font Style */
  362. /*------------------------------------------------------------------------------------------------------*/
  363. /* SPECIAL FONT USAGE NOTES: You can specify the font to use for many control types.
  364. The constants below are meta-font numbers which you can use to set a particular
  365. control's font usage. There are essentially two modes you can use: 1) default,
  366. which is essentially the same as it always has been, i.e. it uses the system font, unless
  367. directed to use the window font via a control variant. 2) you can specify to use
  368. the big or small system font in a generic manner. The Big system font is the font
  369. used in menus, etc. Chicago has filled that role for some time now. Small system
  370. font is currently Geneva 10. The meta-font number implies the size and style.
  371. NOTE: Not all font attributes are used by all controls. Most, in fact, ignore
  372. the fore and back color (Static Text is the only one that does, for
  373. backwards compatibility). Also size, face, and addFontSize are ignored
  374. when using the meta-font numbering.
  375. */
  376. /* Meta-font numbering - see note above */
  377. enum {
  378. kControlFontBigSystemFont = -1, /* force to big system font*/
  379. kControlFontSmallSystemFont = -2, /* force to small system font*/
  380. kControlFontSmallBoldSystemFont = -3, /* force to small bold system font*/
  381. kControlFontViewSystemFont = -4 /* force to views system font (DataBrowser control only)*/
  382. };
  383. /* Add these masks together to set the flags field of a ControlFontStyleRec */
  384. /* They specify which fields to apply to the text. It is important to make */
  385. /* sure that you specify only the fields that you wish to set. */
  386. enum {
  387. kControlUseFontMask = 0x0001,
  388. kControlUseFaceMask = 0x0002,
  389. kControlUseSizeMask = 0x0004,
  390. kControlUseForeColorMask = 0x0008,
  391. kControlUseBackColorMask = 0x0010,
  392. kControlUseModeMask = 0x0020,
  393. kControlUseJustMask = 0x0040,
  394. kControlUseAllMask = 0x00FF,
  395. kControlAddFontSizeMask = 0x0100
  396. };
  397. /* AddToMetaFont indicates that we want to start with a standard system */
  398. /* font, but then we'd like to add the other attributes. Normally, the meta */
  399. /* font ignores all other flags */
  400. enum {
  401. kControlAddToMetaFontMask = 0x0200 /* Available in Appearance 1.1 or later*/
  402. };
  403. /* UseThemeFontID indicates that the font field of the ControlFontStyleRec */
  404. /* should be interpreted as a ThemeFontID (see Appearance.h). In all other */
  405. /* ways, specifying a ThemeFontID is just like using one of the control */
  406. /* meta-fonts IDs. */
  407. enum {
  408. kControlUseThemeFontIDMask = 0x0080 /* Available in Mac OS X or later*/
  409. };
  410. struct ControlFontStyleRec {
  411. SInt16 flags;
  412. SInt16 font;
  413. SInt16 size;
  414. SInt16 style;
  415. SInt16 mode;
  416. SInt16 just;
  417. RGBColor foreColor;
  418. RGBColor backColor;
  419. };
  420. typedef struct ControlFontStyleRec ControlFontStyleRec;
  421. typedef ControlFontStyleRec * ControlFontStylePtr;
  422. /*------------------------------------------------------------------------------------------------------*/
  423. /* o Click Activation Results */
  424. /*------------------------------------------------------------------------------------------------------*/
  425. /* These are for use with GetControlClickActivation. The enumerated values should be pretty */
  426. /* self-explanatory, but just in case: */
  427. /* o Activate/DoNotActivate indicates whether or not to change the owning window's z-ordering before */
  428. /* processing the click. If activation is requested, you may also want to immediately redraw the */
  429. /* newly exposed portion of the window. */
  430. /* o Ignore/Handle Click indicates whether or not to call an appropriate click handling API (like */
  431. /* HandleControlClick) in respose to the event. */
  432. enum {
  433. kDoNotActivateAndIgnoreClick = 0, /* probably never used. here for completeness.*/
  434. kDoNotActivateAndHandleClick = 1, /* let the control handle the click while the window is still in the background.*/
  435. kActivateAndIgnoreClick = 2, /* control doesn't want to respond directly to the click, but window should still be brought forward.*/
  436. kActivateAndHandleClick = 3 /* control wants to respond to the click, but only after the window has been activated.*/
  437. };
  438. typedef UInt32 ClickActivationResult;
  439. /*------------------------------------------------------------------------------------------------------*/
  440. /* o Common data tags for Get/SetControlData */
  441. /*------------------------------------------------------------------------------------------------------*/
  442. /*
  443. * Discussion:
  444. * Get/SetControlData Common Tags
  445. */
  446. enum {
  447. kControlFontStyleTag = FOUR_CHAR_CODE('font'),
  448. kControlKeyFilterTag = FOUR_CHAR_CODE('fltr'),
  449. /*
  450. * Sent with a pointer to a ControlKind record to be filled in. Only
  451. * valid for GetControlData.
  452. */
  453. kControlKindTag = FOUR_CHAR_CODE('kind'),
  454. /*
  455. * Sent with a pointer to a ControlSize. Only valid with explicitly
  456. * sizeable controls. Currently supported by the Check Box, Combo
  457. * Box, Progress Bar, Indeterminate Progress Bar, Radio Button, Round
  458. * Button, Scroll Bar, Slider and the Tab. Check your return value!
  459. */
  460. kControlSizeTag = FOUR_CHAR_CODE('size')
  461. };
  462. /*------------------------------------------------------------------------------------------------------*/
  463. /* o Control Feature Bits */
  464. /*------------------------------------------------------------------------------------------------------*/
  465. enum {
  466. /* Control feature bits - returned by GetControlFeatures */
  467. kControlSupportsGhosting = 1 << 0,
  468. kControlSupportsEmbedding = 1 << 1,
  469. kControlSupportsFocus = 1 << 2,
  470. kControlWantsIdle = 1 << 3,
  471. kControlWantsActivate = 1 << 4,
  472. kControlHandlesTracking = 1 << 5,
  473. kControlSupportsDataAccess = 1 << 6,
  474. kControlHasSpecialBackground = 1 << 7,
  475. kControlGetsFocusOnClick = 1 << 8,
  476. kControlSupportsCalcBestRect = 1 << 9,
  477. kControlSupportsLiveFeedback = 1 << 10,
  478. kControlHasRadioBehavior = 1 << 11, /* Available in Appearance 1.0.1 or later*/
  479. kControlSupportsDragAndDrop = 1 << 12, /* Available in Carbon*/
  480. kControlAutoToggles = 1 << 14, /* Available in Appearance 1.1 or later*/
  481. kControlSupportsGetRegion = 1 << 17, /* Available in Appearance 1.1 or later*/
  482. kControlSupportsFlattening = 1 << 19, /* Available in Carbon*/
  483. kControlSupportsSetCursor = 1 << 20, /* Available in Carbon*/
  484. kControlSupportsContextualMenus = 1 << 21, /* Available in Carbon*/
  485. kControlSupportsClickActivation = 1 << 22, /* Available in Carbon*/
  486. kControlIdlesWithTimer = 1 << 23 /* Available in Carbon - this bit indicates that the control animates automatically*/
  487. };
  488. /*------------------------------------------------------------------------------------------------------*/
  489. /* o Control Messages */
  490. /*------------------------------------------------------------------------------------------------------*/
  491. enum {
  492. drawCntl = 0,
  493. testCntl = 1,
  494. calcCRgns = 2,
  495. initCntl = 3, /* Param is Collection, result is OSStatus*/
  496. dispCntl = 4,
  497. posCntl = 5,
  498. thumbCntl = 6,
  499. dragCntl = 7,
  500. autoTrack = 8,
  501. calcCntlRgn = 10,
  502. calcThumbRgn = 11,
  503. drawThumbOutline = 12,
  504. kControlMsgDrawGhost = 13,
  505. kControlMsgCalcBestRect = 14, /* Calculate best fitting rectangle for control*/
  506. kControlMsgHandleTracking = 15,
  507. kControlMsgFocus = 16, /* param indicates action.*/
  508. kControlMsgKeyDown = 17,
  509. kControlMsgIdle = 18,
  510. kControlMsgGetFeatures = 19,
  511. kControlMsgSetData = 20,
  512. kControlMsgGetData = 21,
  513. kControlMsgActivate = 22,
  514. kControlMsgSetUpBackground = 23,
  515. kControlMsgCalcValueFromPos = 26,
  516. kControlMsgTestNewMsgSupport = 27, /* See if this control supports new messaging*/
  517. kControlMsgSubValueChanged = 25, /* Available in Appearance 1.0.1 or later*/
  518. kControlMsgSubControlAdded = 28, /* Available in Appearance 1.0.1 or later*/
  519. kControlMsgSubControlRemoved = 29, /* Available in Appearance 1.0.1 or later*/
  520. kControlMsgApplyTextColor = 30, /* Available in Appearance 1.1 or later*/
  521. kControlMsgGetRegion = 31, /* Available in Appearance 1.1 or later*/
  522. kControlMsgFlatten = 32, /* Available in Carbon. Param is Collection.*/
  523. kControlMsgSetCursor = 33, /* Available in Carbon. Param is ControlSetCursorRec*/
  524. kControlMsgDragEnter = 38, /* Available in Carbon. Param is DragRef, result is boolean indicating acceptibility of drag.*/
  525. kControlMsgDragLeave = 39, /* Available in Carbon. As above.*/
  526. kControlMsgDragWithin = 40, /* Available in Carbon. As above.*/
  527. kControlMsgDragReceive = 41, /* Available in Carbon. Param is DragRef, result is OSStatus indicating success/failure.*/
  528. kControlMsgDisplayDebugInfo = 46, /* Available in Carbon on X.*/
  529. kControlMsgContextualMenuClick = 47, /* Available in Carbon. Param is ControlContextualMenuClickRec*/
  530. kControlMsgGetClickActivation = 48 /* Available in Carbon. Param is ControlClickActivationRec*/
  531. };
  532. typedef SInt16 ControlDefProcMessage;
  533. /*--------------------------------------------------------------------------------------*/
  534. /* o Control Sizes */
  535. /*--------------------------------------------------------------------------------------*/
  536. /*
  537. * Discussion:
  538. * ControlSize values to be used in conjunction with SetControlData
  539. * and the kControlSizeTag.
  540. */
  541. enum {
  542. /*
  543. * Use the control's default drawing variant. This does not apply to
  544. * Scroll Bars, for which Normal is Large.
  545. */
  546. kControlSizeNormal = 0,
  547. /*
  548. * Use the control's small drawing variant. Currently supported by
  549. * the Check Box, Combo Box, Radio Button, Scroll Bar, Slider and Tab
  550. * controls.
  551. */
  552. kControlSizeSmall = 1,
  553. /*
  554. * Use the control's small drawing variant. Currently supported by
  555. * the Indeterminate Progress Bar, Progress Bar and Round Button
  556. * controls.
  557. */
  558. kControlSizeLarge = 2,
  559. /*
  560. * Control drawing variant determined by the control's bounds. This
  561. * ControlSize is only available with Scroll Bars to support their
  562. * legacy behavior of drawing differently within different bounds.
  563. */
  564. kControlSizeAuto = 0xFFFF
  565. };
  566. typedef UInt16 ControlSize;
  567. /*--------------------------------------------------------------------------------------*/
  568. /* o Constants for drawCntl message (passed in param) */
  569. /*--------------------------------------------------------------------------------------*/
  570. enum {
  571. kDrawControlEntireControl = 0,
  572. kDrawControlIndicatorOnly = 129
  573. };
  574. /*--------------------------------------------------------------------------------------*/
  575. /* o Constants for dragCntl message (passed in param) */
  576. /*--------------------------------------------------------------------------------------*/
  577. enum {
  578. kDragControlEntireControl = 0,
  579. kDragControlIndicator = 1
  580. };
  581. /*--------------------------------------------------------------------------------------*/
  582. /* o Drag Constraint Structure for thumbCntl message (passed in param) */
  583. /*--------------------------------------------------------------------------------------*/
  584. struct IndicatorDragConstraint {
  585. Rect limitRect;
  586. Rect slopRect;
  587. DragConstraint axis;
  588. };
  589. typedef struct IndicatorDragConstraint IndicatorDragConstraint;
  590. typedef IndicatorDragConstraint * IndicatorDragConstraintPtr;
  591. /*--------------------------------------------------------------------------------------*/
  592. /* CDEF should return as result of kControlMsgTestNewMsgSupport */
  593. /*--------------------------------------------------------------------------------------*/
  594. enum {
  595. kControlSupportsNewMessages = FOUR_CHAR_CODE(' ok ')
  596. };
  597. /*--------------------------------------------------------------------------------------*/
  598. /* This structure is passed into a CDEF when called with the kControlMsgHandleTracking */
  599. /* message */
  600. /*--------------------------------------------------------------------------------------*/
  601. struct ControlTrackingRec {
  602. Point startPt;
  603. EventModifiers modifiers;
  604. ControlActionUPP action;
  605. };
  606. typedef struct ControlTrackingRec ControlTrackingRec;
  607. typedef ControlTrackingRec * ControlTrackingPtr;
  608. /*--------------------------------------------------------------------------------------*/
  609. /* This structure is passed into a CDEF when called with the kControlMsgKeyDown message */
  610. /*--------------------------------------------------------------------------------------*/
  611. struct ControlKeyDownRec {
  612. EventModifiers modifiers;
  613. SInt16 keyCode;
  614. SInt16 charCode;
  615. };
  616. typedef struct ControlKeyDownRec ControlKeyDownRec;
  617. typedef ControlKeyDownRec * ControlKeyDownPtr;
  618. /*--------------------------------------------------------------------------------------*/
  619. /* This structure is passed into a CDEF when called with the kControlMsgGetData or */
  620. /* kControlMsgSetData message */
  621. /*--------------------------------------------------------------------------------------*/
  622. struct ControlDataAccessRec {
  623. ResType tag;
  624. ResType part;
  625. Size size;
  626. Ptr dataPtr;
  627. };
  628. typedef struct ControlDataAccessRec ControlDataAccessRec;
  629. typedef ControlDataAccessRec * ControlDataAccessPtr;
  630. /*--------------------------------------------------------------------------------------*/
  631. /* This structure is passed into a CDEF when called with the kControlCalcBestRect msg */
  632. /*--------------------------------------------------------------------------------------*/
  633. struct ControlCalcSizeRec {
  634. SInt16 height;
  635. SInt16 width;
  636. SInt16 baseLine;
  637. };
  638. typedef struct ControlCalcSizeRec ControlCalcSizeRec;
  639. typedef ControlCalcSizeRec * ControlCalcSizePtr;
  640. /*--------------------------------------------------------------------------------------*/
  641. /* This structure is passed into a CDEF when called with the kControlMsgSetUpBackground */
  642. /* message is sent */
  643. /*--------------------------------------------------------------------------------------*/
  644. struct ControlBackgroundRec {
  645. SInt16 depth;
  646. Boolean colorDevice;
  647. };
  648. typedef struct ControlBackgroundRec ControlBackgroundRec;
  649. typedef ControlBackgroundRec * ControlBackgroundPtr;
  650. /*--------------------------------------------------------------------------------------*/
  651. /* This structure is passed into a CDEF when called with the kControlMsgApplyTextColor */
  652. /* message is sent */
  653. /*--------------------------------------------------------------------------------------*/
  654. struct ControlApplyTextColorRec {
  655. SInt16 depth;
  656. Boolean colorDevice;
  657. Boolean active;
  658. };
  659. typedef struct ControlApplyTextColorRec ControlApplyTextColorRec;
  660. typedef ControlApplyTextColorRec * ControlApplyTextColorPtr;
  661. /*--------------------------------------------------------------------------------------*/
  662. /* This structure is passed into a CDEF when called with the kControlMsgGetRegion */
  663. /* message is sent */
  664. /*--------------------------------------------------------------------------------------*/
  665. struct ControlGetRegionRec {
  666. RgnHandle region;
  667. ControlPartCode part;
  668. };
  669. typedef struct ControlGetRegionRec ControlGetRegionRec;
  670. typedef ControlGetRegionRec * ControlGetRegionPtr;
  671. /*--------------------------------------------------------------------------------------*/
  672. /* This structure is passed into a CDEF when the kControlMsgSetCursor message is sent */
  673. /* Only sent on Carbon */
  674. /*--------------------------------------------------------------------------------------*/
  675. struct ControlSetCursorRec {
  676. Point localPoint;
  677. EventModifiers modifiers;
  678. Boolean cursorWasSet; /* your CDEF must set this to true if you set the cursor, or false otherwise*/
  679. };
  680. typedef struct ControlSetCursorRec ControlSetCursorRec;
  681. typedef ControlSetCursorRec * ControlSetCursorPtr;
  682. /*--------------------------------------------------------------------------------------*/
  683. /* This structure is passed into a CDEF when the kControlMsgContextualMenuClick message */
  684. /* is sent */
  685. /* Only sent on Carbon */
  686. /*--------------------------------------------------------------------------------------*/
  687. struct ControlContextualMenuClickRec {
  688. Point localPoint;
  689. Boolean menuDisplayed; /* your CDEF must set this to true if you displayed a menu, or false otherwise*/
  690. };
  691. typedef struct ControlContextualMenuClickRec ControlContextualMenuClickRec;
  692. typedef ControlContextualMenuClickRec * ControlContextualMenuClickPtr;
  693. /*--------------------------------------------------------------------------------------*/
  694. /* This structure is passed into a CDEF when the kControlMsgGetClickActivation message */
  695. /* is sent */
  696. /* Only sent on Carbon */
  697. /*--------------------------------------------------------------------------------------*/
  698. struct ControlClickActivationRec {
  699. Point localPoint;
  700. EventModifiers modifiers;
  701. ClickActivationResult result; /* your CDEF must pass the desired result back*/
  702. };
  703. typedef struct ControlClickActivationRec ControlClickActivationRec;
  704. typedef ControlClickActivationRec * ControlClickActivationPtr;
  705. /*--------------------------------------------------------------------------------------*/
  706. /* o 'CDEF' entrypoint */
  707. /*--------------------------------------------------------------------------------------*/
  708. typedef CALLBACK_API( SInt32 , ControlDefProcPtr )(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param);
  709. typedef STACK_UPP_TYPE(ControlDefProcPtr) ControlDefUPP;
  710. /*
  711. * NewControlDefUPP()
  712. *
  713. * Availability:
  714. * Non-Carbon CFM: available as macro/inline
  715. * CarbonLib: in CarbonLib 1.0 and later
  716. * Mac OS X: in version 10.0 and later
  717. */
  718. EXTERN_API_C( ControlDefUPP )
  719. NewControlDefUPP(ControlDefProcPtr userRoutine);
  720. #if !OPAQUE_UPP_TYPES
  721. enum { uppControlDefProcInfo = 0x00003BB0 }; /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  722. #ifdef __cplusplus
  723. inline DEFINE_API_C(ControlDefUPP) NewControlDefUPP(ControlDefProcPtr userRoutine) { return (ControlDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlDefProcInfo, GetCurrentArchitecture()); }
  724. #else
  725. #define NewControlDefUPP(userRoutine) (ControlDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlDefProcInfo, GetCurrentArchitecture())
  726. #endif
  727. #endif
  728. /*
  729. * DisposeControlDefUPP()
  730. *
  731. * Availability:
  732. * Non-Carbon CFM: available as macro/inline
  733. * CarbonLib: in CarbonLib 1.0 and later
  734. * Mac OS X: in version 10.0 and later
  735. */
  736. EXTERN_API_C( void )
  737. DisposeControlDefUPP(ControlDefUPP userUPP);
  738. #if !OPAQUE_UPP_TYPES
  739. #ifdef __cplusplus
  740. inline DEFINE_API_C(void) DisposeControlDefUPP(ControlDefUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  741. #else
  742. #define DisposeControlDefUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  743. #endif
  744. #endif
  745. /*
  746. * InvokeControlDefUPP()
  747. *
  748. * Availability:
  749. * Non-Carbon CFM: available as macro/inline
  750. * CarbonLib: in CarbonLib 1.0 and later
  751. * Mac OS X: in version 10.0 and later
  752. */
  753. EXTERN_API_C( SInt32 )
  754. InvokeControlDefUPP(
  755. SInt16 varCode,
  756. ControlRef theControl,
  757. ControlDefProcMessage message,
  758. SInt32 param,
  759. ControlDefUPP userUPP);
  760. #if !OPAQUE_UPP_TYPES
  761. #ifdef __cplusplus
  762. inline DEFINE_API_C(SInt32) InvokeControlDefUPP(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param, ControlDefUPP userUPP) { return (SInt32)CALL_FOUR_PARAMETER_UPP(userUPP, uppControlDefProcInfo, varCode, theControl, message, param); }
  763. #else
  764. #define InvokeControlDefUPP(varCode, theControl, message, param, userUPP) (SInt32)CALL_FOUR_PARAMETER_UPP((userUPP), uppControlDefProcInfo, (varCode), (theControl), (message), (param))
  765. #endif
  766. #endif
  767. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  768. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  769. #define NewControlDefProc(userRoutine) NewControlDefUPP(userRoutine)
  770. #define CallControlDefProc(userRoutine, varCode, theControl, message, param) InvokeControlDefUPP(varCode, theControl, message, param, userRoutine)
  771. #endif /* CALL_NOT_IN_CARBON */
  772. /*--------------------------------------------------------------------------------------*/
  773. /* Control Key Filter */
  774. /*--------------------------------------------------------------------------------------*/
  775. /* Certain controls can have a keyfilter attached to them. */
  776. /* Definition of a key filter for intercepting and possibly changing keystrokes */
  777. /* which are destined for a control. */
  778. /* Key Filter Result Codes */
  779. /* The filter proc should return one of the two constants below. If */
  780. /* kKeyFilterBlockKey is returned, the key is blocked and never makes it to the */
  781. /* control. If kKeyFilterPassKey is returned, the control receives the keystroke. */
  782. enum {
  783. kControlKeyFilterBlockKey = 0,
  784. kControlKeyFilterPassKey = 1
  785. };
  786. typedef SInt16 ControlKeyFilterResult;
  787. typedef CALLBACK_API( ControlKeyFilterResult , ControlKeyFilterProcPtr )(ControlRef theControl, SInt16 *keyCode, SInt16 *charCode, EventModifiers *modifiers);
  788. typedef STACK_UPP_TYPE(ControlKeyFilterProcPtr) ControlKeyFilterUPP;
  789. /*
  790. * NewControlKeyFilterUPP()
  791. *
  792. * Availability:
  793. * Non-Carbon CFM: available as macro/inline
  794. * CarbonLib: in CarbonLib 1.0 and later
  795. * Mac OS X: in version 10.0 and later
  796. */
  797. EXTERN_API_C( ControlKeyFilterUPP )
  798. NewControlKeyFilterUPP(ControlKeyFilterProcPtr userRoutine);
  799. #if !OPAQUE_UPP_TYPES
  800. enum { uppControlKeyFilterProcInfo = 0x00003FE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  801. #ifdef __cplusplus
  802. inline DEFINE_API_C(ControlKeyFilterUPP) NewControlKeyFilterUPP(ControlKeyFilterProcPtr userRoutine) { return (ControlKeyFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlKeyFilterProcInfo, GetCurrentArchitecture()); }
  803. #else
  804. #define NewControlKeyFilterUPP(userRoutine) (ControlKeyFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlKeyFilterProcInfo, GetCurrentArchitecture())
  805. #endif
  806. #endif
  807. /*
  808. * DisposeControlKeyFilterUPP()
  809. *
  810. * Availability:
  811. * Non-Carbon CFM: available as macro/inline
  812. * CarbonLib: in CarbonLib 1.0 and later
  813. * Mac OS X: in version 10.0 and later
  814. */
  815. EXTERN_API_C( void )
  816. DisposeControlKeyFilterUPP(ControlKeyFilterUPP userUPP);
  817. #if !OPAQUE_UPP_TYPES
  818. #ifdef __cplusplus
  819. inline DEFINE_API_C(void) DisposeControlKeyFilterUPP(ControlKeyFilterUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  820. #else
  821. #define DisposeControlKeyFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  822. #endif
  823. #endif
  824. /*
  825. * InvokeControlKeyFilterUPP()
  826. *
  827. * Availability:
  828. * Non-Carbon CFM: available as macro/inline
  829. * CarbonLib: in CarbonLib 1.0 and later
  830. * Mac OS X: in version 10.0 and later
  831. */
  832. EXTERN_API_C( ControlKeyFilterResult )
  833. InvokeControlKeyFilterUPP(
  834. ControlRef theControl,
  835. SInt16 * keyCode,
  836. SInt16 * charCode,
  837. EventModifiers * modifiers,
  838. ControlKeyFilterUPP userUPP);
  839. #if !OPAQUE_UPP_TYPES
  840. #ifdef __cplusplus
  841. inline DEFINE_API_C(ControlKeyFilterResult) InvokeControlKeyFilterUPP(ControlRef theControl, SInt16 * keyCode, SInt16 * charCode, EventModifiers * modifiers, ControlKeyFilterUPP userUPP) { return (ControlKeyFilterResult)CALL_FOUR_PARAMETER_UPP(userUPP, uppControlKeyFilterProcInfo, theControl, keyCode, charCode, modifiers); }
  842. #else
  843. #define InvokeControlKeyFilterUPP(theControl, keyCode, charCode, modifiers, userUPP) (ControlKeyFilterResult)CALL_FOUR_PARAMETER_UPP((userUPP), uppControlKeyFilterProcInfo, (theControl), (keyCode), (charCode), (modifiers))
  844. #endif
  845. #endif
  846. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  847. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  848. #define NewControlKeyFilterProc(userRoutine) NewControlKeyFilterUPP(userRoutine)
  849. #define CallControlKeyFilterProc(userRoutine, theControl, keyCode, charCode, modifiers) InvokeControlKeyFilterUPP(theControl, keyCode, charCode, modifiers, userRoutine)
  850. #endif /* CALL_NOT_IN_CARBON */
  851. /*--------------------------------------------------------------------------------------*/
  852. /* o DragGrayRgn Constatns */
  853. /* */
  854. /* For DragGrayRgnUPP used in TrackControl() */
  855. /*--------------------------------------------------------------------------------------*/
  856. enum {
  857. noConstraint = kNoConstraint,
  858. hAxisOnly = 1,
  859. vAxisOnly = 2
  860. };
  861. /*--------------------------------------------------------------------------------------*/
  862. /* o Control Creation/Deletion/Persistence */
  863. /*--------------------------------------------------------------------------------------*/
  864. /* CreateCustomControl is only available as part of Carbon */
  865. enum {
  866. kControlDefProcPtr = 0, /* raw proc-ptr based access*/
  867. kControlDefObjectClass = 1 /* event-based definition (Mac OS X only)*/
  868. };
  869. typedef UInt32 ControlDefType;
  870. struct ControlDefSpec {
  871. ControlDefType defType;
  872. union {
  873. ControlDefUPP defProc;
  874. void * classRef;
  875. } u;
  876. };
  877. typedef struct ControlDefSpec ControlDefSpec;
  878. /*
  879. * CreateCustomControl()
  880. *
  881. * Availability:
  882. * Non-Carbon CFM: not available
  883. * CarbonLib: in CarbonLib 1.0 and later
  884. * Mac OS X: in version 10.0 and later
  885. */
  886. EXTERN_API( OSStatus )
  887. CreateCustomControl(
  888. WindowRef owningWindow,
  889. const Rect * contBounds,
  890. const ControlDefSpec * def,
  891. Collection initData,
  892. ControlRef * outControl);
  893. /*
  894. * NewControl()
  895. *
  896. * Availability:
  897. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  898. * CarbonLib: in CarbonLib 1.0 and later
  899. * Mac OS X: in version 10.0 and later
  900. */
  901. EXTERN_API( ControlRef )
  902. NewControl(
  903. WindowRef owningWindow,
  904. const Rect * boundsRect,
  905. ConstStr255Param controlTitle,
  906. Boolean initiallyVisible,
  907. SInt16 initialValue,
  908. SInt16 minimumValue,
  909. SInt16 maximumValue,
  910. SInt16 procID,
  911. SInt32 controlReference) ONEWORDINLINE(0xA954);
  912. /*
  913. * GetNewControl()
  914. *
  915. * Availability:
  916. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  917. * CarbonLib: in CarbonLib 1.0 and later
  918. * Mac OS X: in version 10.0 and later
  919. */
  920. EXTERN_API( ControlRef )
  921. GetNewControl(
  922. SInt16 resourceID,
  923. WindowRef owningWindow) ONEWORDINLINE(0xA9BE);
  924. /*
  925. * DisposeControl()
  926. *
  927. * Availability:
  928. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  929. * CarbonLib: in CarbonLib 1.0 and later
  930. * Mac OS X: in version 10.0 and later
  931. */
  932. EXTERN_API( void )
  933. DisposeControl(ControlRef theControl) ONEWORDINLINE(0xA955);
  934. /*
  935. * KillControls()
  936. *
  937. * Availability:
  938. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  939. * CarbonLib: in CarbonLib 1.0 and later
  940. * Mac OS X: in version 10.0 and later
  941. */
  942. EXTERN_API( void )
  943. KillControls(WindowRef theWindow) ONEWORDINLINE(0xA956);
  944. /*--------------------------------------------------------------------------------------*/
  945. /* o Control Definition Registration */
  946. /*--------------------------------------------------------------------------------------*/
  947. typedef CALLBACK_API( OSStatus , ControlCNTLToCollectionProcPtr )(const Rect *bounds, SInt16 value, Boolean visible, SInt16 max, SInt16 min, SInt16 procID, SInt32 refCon, ConstStr255Param title, Collection collection);
  948. typedef STACK_UPP_TYPE(ControlCNTLToCollectionProcPtr) ControlCNTLToCollectionUPP;
  949. /*
  950. * NewControlCNTLToCollectionUPP()
  951. *
  952. * Availability:
  953. * Non-Carbon CFM: available as macro/inline
  954. * CarbonLib: in CarbonLib 1.0 and later
  955. * Mac OS X: in version 10.0 and later
  956. */
  957. EXTERN_API_C( ControlCNTLToCollectionUPP )
  958. NewControlCNTLToCollectionUPP(ControlCNTLToCollectionProcPtr userRoutine);
  959. #if !OPAQUE_UPP_TYPES
  960. enum { uppControlCNTLToCollectionProcInfo = 0x00FEA6F0 }; /* pascal 4_bytes Func(4_bytes, 2_bytes, 1_byte, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  961. #ifdef __cplusplus
  962. inline DEFINE_API_C(ControlCNTLToCollectionUPP) NewControlCNTLToCollectionUPP(ControlCNTLToCollectionProcPtr userRoutine) { return (ControlCNTLToCollectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlCNTLToCollectionProcInfo, GetCurrentArchitecture()); }
  963. #else
  964. #define NewControlCNTLToCollectionUPP(userRoutine) (ControlCNTLToCollectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlCNTLToCollectionProcInfo, GetCurrentArchitecture())
  965. #endif
  966. #endif
  967. /*
  968. * DisposeControlCNTLToCollectionUPP()
  969. *
  970. * Availability:
  971. * Non-Carbon CFM: available as macro/inline
  972. * CarbonLib: in CarbonLib 1.0 and later
  973. * Mac OS X: in version 10.0 and later
  974. */
  975. EXTERN_API_C( void )
  976. DisposeControlCNTLToCollectionUPP(ControlCNTLToCollectionUPP userUPP);
  977. #if !OPAQUE_UPP_TYPES
  978. #ifdef __cplusplus
  979. inline DEFINE_API_C(void) DisposeControlCNTLToCollectionUPP(ControlCNTLToCollectionUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  980. #else
  981. #define DisposeControlCNTLToCollectionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  982. #endif
  983. #endif
  984. /*
  985. * InvokeControlCNTLToCollectionUPP()
  986. *
  987. * Availability:
  988. * Non-Carbon CFM: available as macro/inline
  989. * CarbonLib: in CarbonLib 1.0 and later
  990. * Mac OS X: in version 10.0 and later
  991. */
  992. EXTERN_API_C( OSStatus )
  993. InvokeControlCNTLToCollectionUPP(
  994. const Rect * bounds,
  995. SInt16 value,
  996. Boolean visible,
  997. SInt16 max,
  998. SInt16 min,
  999. SInt16 procID,
  1000. SInt32 refCon,
  1001. ConstStr255Param title,
  1002. Collection collection,
  1003. ControlCNTLToCollectionUPP userUPP);
  1004. #if !OPAQUE_UPP_TYPES
  1005. #ifdef __cplusplus
  1006. inline DEFINE_API_C(OSStatus) InvokeControlCNTLToCollectionUPP(const Rect * bounds, SInt16 value, Boolean visible, SInt16 max, SInt16 min, SInt16 procID, SInt32 refCon, ConstStr255Param title, Collection collection, ControlCNTLToCollectionUPP userUPP) { return (OSStatus)CALL_NINE_PARAMETER_UPP(userUPP, uppControlCNTLToCollectionProcInfo, bounds, value, visible, max, min, procID, refCon, title, collection); }
  1007. #else
  1008. #define InvokeControlCNTLToCollectionUPP(bounds, value, visible, max, min, procID, refCon, title, collection, userUPP) (OSStatus)CALL_NINE_PARAMETER_UPP((userUPP), uppControlCNTLToCollectionProcInfo, (bounds), (value), (visible), (max), (min), (procID), (refCon), (title), (collection))
  1009. #endif
  1010. #endif
  1011. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  1012. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  1013. #define NewControlCNTLToCollectionProc(userRoutine) NewControlCNTLToCollectionUPP(userRoutine)
  1014. #define CallControlCNTLToCollectionProc(userRoutine, bounds, value, visible, max, min, procID, refCon, title, collection) InvokeControlCNTLToCollectionUPP(bounds, value, visible, max, min, procID, refCon, title, collection, userRoutine)
  1015. #endif /* CALL_NOT_IN_CARBON */
  1016. /*
  1017. * RegisterControlDefinition()
  1018. *
  1019. * Summary:
  1020. * Associates or dissociates a control definition with a virtual
  1021. * CDEF resource ID.
  1022. *
  1023. * Discussion:
  1024. * In GetNewControl or NewControl on Carbon, the Control Manager
  1025. * needs to know how to map the procID to a ControlDefSpec. With
  1026. * RegisterControlDefinition, your application can inform the
  1027. * Control Manager which ControlDefSpec to call when it sees a
  1028. * request to use a 'CDEF' of a particular resource ID. Since custom
  1029. * control definitions receive their initialization data in a
  1030. * Collection passed in the 'param' parameter, you must also provide
  1031. * a procedure to convert the bounds, min, max, and other parameters
  1032. * to NewControl into a Collection. If you don't provide a
  1033. * conversion proc, your control will receive an empty collection
  1034. * when it is sent the initialization message. If you want the
  1035. * value, min, visibility, etc. to be given to the control, you must
  1036. * add the appropriate tagged data to the collection. See the
  1037. * Control Collection Tags above. If you want to unregister a
  1038. * ControlDefSpec that you have already registered, call
  1039. * RegisterControlDefinition with the same CDEF resource ID, but
  1040. * pass NULL for the inControlDef parameter. In this situation,
  1041. * inConversionProc is effectively ignored.
  1042. *
  1043. * Parameters:
  1044. *
  1045. * inCDEFResID:
  1046. * The virtual CDEF resource ID to which you'd like to associate
  1047. * or dissociate the control definition.
  1048. *
  1049. * inControlDef:
  1050. * A pointer to a ControlDefSpec which represents the control
  1051. * definition you want to register, or NULL if you are attempting
  1052. * to unregister a control definition.
  1053. *
  1054. * inConversionProc:
  1055. * The conversion proc which will translate the NewControl
  1056. * parameters into a Collection.
  1057. *
  1058. * Result:
  1059. * An OSStatus code indicating success or failure.
  1060. *
  1061. * Availability:
  1062. * Non-Carbon CFM: not available
  1063. * CarbonLib: in CarbonLib 1.0 and later
  1064. * Mac OS X: in version 10.0 and later
  1065. */
  1066. EXTERN_API( OSStatus )
  1067. RegisterControlDefinition(
  1068. SInt16 inCDEFResID,
  1069. const ControlDefSpec * inControlDef,
  1070. ControlCNTLToCollectionUPP inConversionProc);
  1071. /*--------------------------------------------------------------------------------------*/
  1072. /* o Control Visible State */
  1073. /*--------------------------------------------------------------------------------------*/
  1074. /*
  1075. * HiliteControl()
  1076. *
  1077. * Availability:
  1078. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1079. * CarbonLib: in CarbonLib 1.0 and later
  1080. * Mac OS X: in version 10.0 and later
  1081. */
  1082. EXTERN_API( void )
  1083. HiliteControl(
  1084. ControlRef theControl,
  1085. ControlPartCode hiliteState) ONEWORDINLINE(0xA95D);
  1086. /*
  1087. * ShowControl()
  1088. *
  1089. * Availability:
  1090. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1091. * CarbonLib: in CarbonLib 1.0 and later
  1092. * Mac OS X: in version 10.0 and later
  1093. */
  1094. EXTERN_API( void )
  1095. ShowControl(ControlRef theControl) ONEWORDINLINE(0xA957);
  1096. /*
  1097. * HideControl()
  1098. *
  1099. * Availability:
  1100. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1101. * CarbonLib: in CarbonLib 1.0 and later
  1102. * Mac OS X: in version 10.0 and later
  1103. */
  1104. EXTERN_API( void )
  1105. HideControl(ControlRef theControl) ONEWORDINLINE(0xA958);
  1106. /* following state routines available only with Appearance 1.0 and later*/
  1107. /*
  1108. * IsControlActive()
  1109. *
  1110. * Availability:
  1111. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1112. * CarbonLib: in CarbonLib 1.0 and later
  1113. * Mac OS X: in version 10.0 and later
  1114. */
  1115. EXTERN_API( Boolean )
  1116. IsControlActive(ControlRef inControl) THREEWORDINLINE(0x303C, 0x0005, 0xAA73);
  1117. /*
  1118. * IsControlVisible()
  1119. *
  1120. * Availability:
  1121. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1122. * CarbonLib: in CarbonLib 1.0 and later
  1123. * Mac OS X: in version 10.0 and later
  1124. */
  1125. EXTERN_API( Boolean )
  1126. IsControlVisible(ControlRef inControl) THREEWORDINLINE(0x303C, 0x0006, 0xAA73);
  1127. /*
  1128. * ActivateControl()
  1129. *
  1130. * Availability:
  1131. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1132. * CarbonLib: in CarbonLib 1.0 and later
  1133. * Mac OS X: in version 10.0 and later
  1134. */
  1135. EXTERN_API( OSErr )
  1136. ActivateControl(ControlRef inControl) THREEWORDINLINE(0x303C, 0x0007, 0xAA73);
  1137. /*
  1138. * DeactivateControl()
  1139. *
  1140. * Availability:
  1141. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1142. * CarbonLib: in CarbonLib 1.0 and later
  1143. * Mac OS X: in version 10.0 and later
  1144. */
  1145. EXTERN_API( OSErr )
  1146. DeactivateControl(ControlRef inControl) THREEWORDINLINE(0x303C, 0x0008, 0xAA73);
  1147. /*
  1148. * SetControlVisibility()
  1149. *
  1150. * Availability:
  1151. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1152. * CarbonLib: in CarbonLib 1.0 and later
  1153. * Mac OS X: in version 10.0 and later
  1154. */
  1155. EXTERN_API( OSErr )
  1156. SetControlVisibility(
  1157. ControlRef inControl,
  1158. Boolean inIsVisible,
  1159. Boolean inDoDraw) THREEWORDINLINE(0x303C, 0x001E, 0xAA73);
  1160. /*--------------------------------------------------------------------------------------*/
  1161. /* o Control Imaging */
  1162. /*--------------------------------------------------------------------------------------*/
  1163. /*
  1164. * DrawControls()
  1165. *
  1166. * Availability:
  1167. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1168. * CarbonLib: in CarbonLib 1.0 and later
  1169. * Mac OS X: in version 10.0 and later
  1170. */
  1171. EXTERN_API( void )
  1172. DrawControls(WindowRef theWindow) ONEWORDINLINE(0xA969);
  1173. /*
  1174. * Draw1Control()
  1175. *
  1176. * Availability:
  1177. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1178. * CarbonLib: in CarbonLib 1.0 and later
  1179. * Mac OS X: in version 10.0 and later
  1180. */
  1181. EXTERN_API( void )
  1182. Draw1Control(ControlRef theControl) ONEWORDINLINE(0xA96D);
  1183. #define DrawOneControl(theControl) Draw1Control(theControl)
  1184. /*
  1185. * UpdateControls()
  1186. *
  1187. * Summary:
  1188. * Redraws the controls that intersect a specified region in a
  1189. * window.
  1190. *
  1191. * Parameters:
  1192. *
  1193. * inWindow:
  1194. * The window whose controls to redraw.
  1195. *
  1196. * inUpdateRegion:
  1197. * The region (in local coordinates) describing which controls to
  1198. * redraw. In Mac OS 10.1 and later, and in CarbonLib 1.5 and
  1199. * later, you may pass NULL for this parameter to redraw the
  1200. * controls intersecting the visible region of the window.
  1201. *
  1202. * Availability:
  1203. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1204. * CarbonLib: in CarbonLib 1.0 and later
  1205. * Mac OS X: in version 10.0 and later
  1206. */
  1207. EXTERN_API( void )
  1208. UpdateControls(
  1209. WindowRef inWindow,
  1210. RgnHandle inUpdateRegion) /* can be NULL */ ONEWORDINLINE(0xA953);
  1211. /* following imaging routines available only with Appearance 1.0 and later*/
  1212. /*
  1213. * GetBestControlRect()
  1214. *
  1215. * Availability:
  1216. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1217. * CarbonLib: in CarbonLib 1.0 and later
  1218. * Mac OS X: in version 10.0 and later
  1219. */
  1220. EXTERN_API( OSErr )
  1221. GetBestControlRect(
  1222. ControlRef inControl,
  1223. Rect * outRect,
  1224. SInt16 * outBaseLineOffset) THREEWORDINLINE(0x303C, 0x001B, 0xAA73);
  1225. /*
  1226. * SetControlFontStyle()
  1227. *
  1228. * Availability:
  1229. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1230. * CarbonLib: in CarbonLib 1.0 and later
  1231. * Mac OS X: in version 10.0 and later
  1232. */
  1233. EXTERN_API( OSErr )
  1234. SetControlFontStyle(
  1235. ControlRef inControl,
  1236. const ControlFontStyleRec * inStyle) THREEWORDINLINE(0x303C, 0x001C, 0xAA73);
  1237. /*
  1238. * DrawControlInCurrentPort()
  1239. *
  1240. * Availability:
  1241. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1242. * CarbonLib: in CarbonLib 1.0 and later
  1243. * Mac OS X: in version 10.0 and later
  1244. */
  1245. EXTERN_API( void )
  1246. DrawControlInCurrentPort(ControlRef inControl) THREEWORDINLINE(0x303C, 0x0018, 0xAA73);
  1247. /*
  1248. * SetUpControlBackground()
  1249. *
  1250. * Summary:
  1251. * Applies the proper background color for the given control to the
  1252. * current port.
  1253. *
  1254. * Discussion:
  1255. * An embedding-savvy control which erases before drawing must
  1256. * ensure that its background color properly matches the body color
  1257. * of any parent controls on top of which it draws. This routine
  1258. * asks the Control Manager to determine and apply the proper
  1259. * background color to the current port. If a ControlColorProc has
  1260. * been provided for the given control, the proc will be called to
  1261. * set up the background color. If no proc exists, or if the proc
  1262. * returns a value other than noErr, the Control Manager ascends the
  1263. * parent chain for the given control looking for a control which
  1264. * has a special background (see the kControlHasSpecialBackground
  1265. * feature bit). The first such parent is asked to set up the
  1266. * background color (see the kControlMsgSetUpBackground message). If
  1267. * no such parent exists, the Control Manager applies any ThemeBrush
  1268. * which has been associated with the owning window (see
  1269. * SetThemeWindowBackground). Available in Appearance 1.0 (Mac OS
  1270. * 8), CarbonLib 1.0, Mac OS X, and later.
  1271. *
  1272. * Parameters:
  1273. *
  1274. * inControl:
  1275. * The ControlRef that wants to erase.
  1276. *
  1277. * inDepth:
  1278. * A short integer indicating the color depth of the device onto
  1279. * which drawing will take place.
  1280. *
  1281. * inIsColorDevice:
  1282. * A Boolean indicating whether the draw device is a color device.
  1283. *
  1284. * Result:
  1285. * An OSStatus code indicating success or failure. The most likely
  1286. * error is a controlHandleInvalidErr, resulting from a bad
  1287. * ControlRef. Any non-noErr result indicates that the color set up
  1288. * failed, and that the caller should probably give up its attempt
  1289. * to draw.
  1290. *
  1291. * Availability:
  1292. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1293. * CarbonLib: in CarbonLib 1.0 and later
  1294. * Mac OS X: in version 10.0 and later
  1295. */
  1296. EXTERN_API( OSErr )
  1297. SetUpControlBackground(
  1298. ControlRef inControl,
  1299. SInt16 inDepth,
  1300. Boolean inIsColorDevice) THREEWORDINLINE(0x303C, 0x001D, 0xAA73);
  1301. /*
  1302. * SetUpControlTextColor()
  1303. *
  1304. * Summary:
  1305. * Applies the proper text color for the given control to the
  1306. * current port.
  1307. *
  1308. * Discussion:
  1309. * An embedding-savvy control which draws text must ensure that its
  1310. * text color properly contrasts the background on which it draws.
  1311. * This routine asks the Control Manager to determine and apply the
  1312. * proper text color to the current port. If a ControlColorProc has
  1313. * been provided for the given control, the proc will be called to
  1314. * set up the text color. If no proc exists, or if the proc returns
  1315. * a value other than noErr, the Control Manager ascends the parent
  1316. * chain for the given control looking for a control which has a
  1317. * special background (see the kControlHasSpecialBackground feature
  1318. * bit). The first such parent is asked to set up the text color
  1319. * (see the kControlMsgApplyTextColor message). If no such parent
  1320. * exists, the Control Manager chooses a text color which contrasts
  1321. * any ThemeBrush which has been associated with the owning window
  1322. * (see SetThemeWindowBackground). Available in Appearance 1.1 (Mac
  1323. * OS 8.5), CarbonLib 1.0, Mac OS X, and later.
  1324. *
  1325. * Parameters:
  1326. *
  1327. * inControl:
  1328. * The ControlRef that wants to draw text.
  1329. *
  1330. * inDepth:
  1331. * A short integer indicating the color depth of the device onto
  1332. * which drawing will take place.
  1333. *
  1334. * inIsColorDevice:
  1335. * A Boolean indicating whether the draw device is a color device.
  1336. *
  1337. * Result:
  1338. * An OSStatus code indicating success or failure. The most likely
  1339. * error is a controlHandleInvalidErr, resulting from a bad
  1340. * ControlRef. Any non-noErr result indicates that the color set up
  1341. * failed, and that the caller should probably give up its attempt
  1342. * to draw.
  1343. *
  1344. * Availability:
  1345. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1346. * CarbonLib: in CarbonLib 1.0 and later
  1347. * Mac OS X: in version 10.0 and later
  1348. */
  1349. EXTERN_API( OSErr )
  1350. SetUpControlTextColor(
  1351. ControlRef inControl,
  1352. SInt16 inDepth,
  1353. Boolean inIsColorDevice);
  1354. /*
  1355. * ControlColorProcPtr
  1356. *
  1357. * Discussion:
  1358. * Callback allowing clients to specify/override the background
  1359. * color and text color that a Control will use during drawing. Your
  1360. * procedure should make the color changes to the current port. See
  1361. * SetControlColorProc, SetUpControlBackground, and
  1362. * SetUpControlTextColor for more information. Available on Mac OS
  1363. * 8.5, CarbonLib 1.1, Mac OS X, and later.
  1364. *
  1365. * Parameters:
  1366. *
  1367. * inControl:
  1368. * A reference to the Control for whom your proc is setting up
  1369. * colors.
  1370. *
  1371. * inMessage:
  1372. * A ControlDefProcMessage indicating what sort of color your
  1373. * procedure should set up. It will be either
  1374. * kControlMsgApplyTextColor or kControlMsgSetUpBackground.
  1375. * kControlMsgApplyTextColor is a request to set up the
  1376. * appropriate text color (by setting the current port's
  1377. * foreground color, pen information, etc.).
  1378. * kControlMsgSetUpBackground is a request to set up the
  1379. * appropriate background color (the current port's background
  1380. * color, pattern, etc.).
  1381. *
  1382. * inDrawDepth:
  1383. * A short integer indicating the bit depth of the device into
  1384. * which the Control is drawing. The bit depth is typically passed
  1385. * in as a result of someone someone trying to draw properly
  1386. * across multiple monitors with different bit depths. If your
  1387. * procedure wants to handle proper color set up based on bit
  1388. * depth, it should use this parameter to help decide what color
  1389. * to apply.
  1390. *
  1391. * inDrawInColor:
  1392. * A Boolean indicating whether or not the device that the Control
  1393. * is drawing into is a color device. The value is typically
  1394. * passed in as a result of someone trying to draw properly across
  1395. * multiple monitors which may or may not be color devices. If
  1396. * your procedure wants to handle proper color set up for both
  1397. * color and grayscale devices, it should use this parameter to
  1398. * help decide what color to apply.
  1399. *
  1400. * Result:
  1401. * An OSStatus code indicating success or failure. Returning noErr
  1402. * is an indication that your proc completely handled the color set
  1403. * up. If you return any other value, the Control Manager will fall
  1404. * back to the normal color set up mechanism.
  1405. */
  1406. typedef CALLBACK_API( OSStatus , ControlColorProcPtr )(ControlRef inControl, SInt16 inMessage, SInt16 inDrawDepth, Boolean inDrawInColor);
  1407. typedef STACK_UPP_TYPE(ControlColorProcPtr) ControlColorUPP;
  1408. /*
  1409. * NewControlColorUPP()
  1410. *
  1411. * Availability:
  1412. * Non-Carbon CFM: available as macro/inline
  1413. * CarbonLib: in CarbonLib 1.1 and later
  1414. * Mac OS X: in version 10.0 and later
  1415. */
  1416. EXTERN_API_C( ControlColorUPP )
  1417. NewControlColorUPP(ControlColorProcPtr userRoutine);
  1418. #if !OPAQUE_UPP_TYPES
  1419. enum { uppControlColorProcInfo = 0x00001AF0 }; /* pascal 4_bytes Func(4_bytes, 2_bytes, 2_bytes, 1_byte) */
  1420. #ifdef __cplusplus
  1421. inline DEFINE_API_C(ControlColorUPP) NewControlColorUPP(ControlColorProcPtr userRoutine) { return (ControlColorUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlColorProcInfo, GetCurrentArchitecture()); }
  1422. #else
  1423. #define NewControlColorUPP(userRoutine) (ControlColorUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlColorProcInfo, GetCurrentArchitecture())
  1424. #endif
  1425. #endif
  1426. /*
  1427. * DisposeControlColorUPP()
  1428. *
  1429. * Availability:
  1430. * Non-Carbon CFM: available as macro/inline
  1431. * CarbonLib: in CarbonLib 1.1 and later
  1432. * Mac OS X: in version 10.0 and later
  1433. */
  1434. EXTERN_API_C( void )
  1435. DisposeControlColorUPP(ControlColorUPP userUPP);
  1436. #if !OPAQUE_UPP_TYPES
  1437. #ifdef __cplusplus
  1438. inline DEFINE_API_C(void) DisposeControlColorUPP(ControlColorUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1439. #else
  1440. #define DisposeControlColorUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1441. #endif
  1442. #endif
  1443. /*
  1444. * InvokeControlColorUPP()
  1445. *
  1446. * Availability:
  1447. * Non-Carbon CFM: available as macro/inline
  1448. * CarbonLib: in CarbonLib 1.1 and later
  1449. * Mac OS X: in version 10.0 and later
  1450. */
  1451. EXTERN_API_C( OSStatus )
  1452. InvokeControlColorUPP(
  1453. ControlRef inControl,
  1454. SInt16 inMessage,
  1455. SInt16 inDrawDepth,
  1456. Boolean inDrawInColor,
  1457. ControlColorUPP userUPP);
  1458. #if !OPAQUE_UPP_TYPES
  1459. #ifdef __cplusplus
  1460. inline DEFINE_API_C(OSStatus) InvokeControlColorUPP(ControlRef inControl, SInt16 inMessage, SInt16 inDrawDepth, Boolean inDrawInColor, ControlColorUPP userUPP) { return (OSStatus)CALL_FOUR_PARAMETER_UPP(userUPP, uppControlColorProcInfo, inControl, inMessage, inDrawDepth, inDrawInColor); }
  1461. #else
  1462. #define InvokeControlColorUPP(inControl, inMessage, inDrawDepth, inDrawInColor, userUPP) (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppControlColorProcInfo, (inControl), (inMessage), (inDrawDepth), (inDrawInColor))
  1463. #endif
  1464. #endif
  1465. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  1466. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  1467. #define NewControlColorProc(userRoutine) NewControlColorUPP(userRoutine)
  1468. #define CallControlColorProc(userRoutine, inControl, inMessage, inDrawDepth, inDrawInColor) InvokeControlColorUPP(inControl, inMessage, inDrawDepth, inDrawInColor, userRoutine)
  1469. #endif /* CALL_NOT_IN_CARBON */
  1470. /*
  1471. * SetControlColorProc()
  1472. *
  1473. * Summary:
  1474. * Associates a ControlColorUPP with a given Control, thereby
  1475. * allowing you to bypass the embedding hierarchy-based color setup
  1476. * of SetUpControlBackground/SetUpControlTextColor and replace it
  1477. * with your own.
  1478. *
  1479. * Discussion:
  1480. * Before an embedded Control can erase, it calls
  1481. * SetUpControlBackground to have its background color set up by any
  1482. * parent controls. Similarly, any Control which draws text calls
  1483. * SetUpControlTextColor to have the appropriate text color set up.
  1484. * This allows certain controls (such as Tabs and Placards) to offer
  1485. * special backgrounds and text colors for any child controls. By
  1486. * default, the SetUp routines only move up the Control Manager
  1487. * embedding hierarchy looking for a parent which has a special
  1488. * background. This is fine in a plain vanilla embedding case, but
  1489. * many application frameworks find it troublesome; if there are
  1490. * interesting views between two Controls in the embedding
  1491. * hierarchy, the framework needs to be in charge of the background
  1492. * and text colors, otherwise drawing defects will occur. You can
  1493. * only associate a single color proc with a given ControlRef.
  1494. * Available on Mac OS 8.5, CarbonLib 1.1, Mac OS X, and later.
  1495. *
  1496. * Parameters:
  1497. *
  1498. * inControl:
  1499. * The ControlRef with whom the color proc should be associated.
  1500. *
  1501. * inProc:
  1502. * The color proc to associate with the ControlRef. If you pass
  1503. * NULL, the ControlRef will be dissociated from any previously
  1504. * installed color proc.
  1505. *
  1506. * Result:
  1507. * An OSStatus code indicating success or failure. The most likely
  1508. * error is a controlHandleInvalidErr resulting from a bad
  1509. * ControlRef.
  1510. *
  1511. * Availability:
  1512. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1513. * CarbonLib: in CarbonLib 1.1 and later
  1514. * Mac OS X: in version 10.0 and later
  1515. */
  1516. EXTERN_API( OSStatus )
  1517. SetControlColorProc(
  1518. ControlRef inControl,
  1519. ControlColorUPP inProc);
  1520. /*--------------------------------------------------------------------------------------*/
  1521. /* o Control Mousing */
  1522. /*--------------------------------------------------------------------------------------*/
  1523. /*
  1524. NOTE ON CONTROL ACTION PROCS
  1525. When using the TrackControl() call when tracking an indicator, the actionProc parameter
  1526. (type ControlActionUPP) should be replaced by a parameter of type DragGrayRgnUPP
  1527. (see Quickdraw.h).
  1528. If, however, you are using the live feedback variants of scroll bars or sliders, you
  1529. must pass a ControlActionUPP in when tracking the indicator as well. This functionality
  1530. is available in Appearance 1.0 or later.
  1531. */
  1532. /*
  1533. * TrackControl()
  1534. *
  1535. * Availability:
  1536. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1537. * CarbonLib: in CarbonLib 1.0 and later
  1538. * Mac OS X: in version 10.0 and later
  1539. */
  1540. EXTERN_API( ControlPartCode )
  1541. TrackControl(
  1542. ControlRef theControl,
  1543. Point startPoint,
  1544. ControlActionUPP actionProc) /* can be NULL */ ONEWORDINLINE(0xA968);
  1545. /*
  1546. * DragControl()
  1547. *
  1548. * Availability:
  1549. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1550. * CarbonLib: in CarbonLib 1.0 and later
  1551. * Mac OS X: in version 10.0 and later
  1552. */
  1553. EXTERN_API( void )
  1554. DragControl(
  1555. ControlRef theControl,
  1556. Point startPoint,
  1557. const Rect * limitRect,
  1558. const Rect * slopRect,
  1559. DragConstraint axis) ONEWORDINLINE(0xA967);
  1560. /*
  1561. * TestControl()
  1562. *
  1563. * Availability:
  1564. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1565. * CarbonLib: in CarbonLib 1.0 and later
  1566. * Mac OS X: in version 10.0 and later
  1567. */
  1568. EXTERN_API( ControlPartCode )
  1569. TestControl(
  1570. ControlRef theControl,
  1571. Point testPoint) ONEWORDINLINE(0xA966);
  1572. /*
  1573. * FindControl()
  1574. *
  1575. * Availability:
  1576. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1577. * CarbonLib: in CarbonLib 1.0 and later
  1578. * Mac OS X: in version 10.0 and later
  1579. */
  1580. EXTERN_API( ControlPartCode )
  1581. FindControl(
  1582. Point testPoint,
  1583. WindowRef theWindow,
  1584. ControlRef * theControl) ONEWORDINLINE(0xA96C);
  1585. /* The following mousing routines available only with Appearance 1.0 and later */
  1586. /* */
  1587. /* HandleControlClick is preferable to TrackControl when running under */
  1588. /* Appearance 1.0 as you can pass in modifiers, which some of the new controls */
  1589. /* use, such as edit text and list boxes. */
  1590. /* NOTE: Passing NULL for the outPart parameter of FindControlUnderMouse is only*/
  1591. /* supported in systems later than 10.1.x */
  1592. /*
  1593. * FindControlUnderMouse()
  1594. *
  1595. * Availability:
  1596. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1597. * CarbonLib: in CarbonLib 1.0 and later
  1598. * Mac OS X: in version 10.0 and later
  1599. */
  1600. EXTERN_API( ControlRef )
  1601. FindControlUnderMouse(
  1602. Point inWhere,
  1603. WindowRef inWindow,
  1604. ControlPartCode * outPart) /* can be NULL */ THREEWORDINLINE(0x303C, 0x0009, 0xAA73);
  1605. /*
  1606. * HandleControlClick()
  1607. *
  1608. * Availability:
  1609. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1610. * CarbonLib: in CarbonLib 1.0 and later
  1611. * Mac OS X: in version 10.0 and later
  1612. */
  1613. EXTERN_API( ControlPartCode )
  1614. HandleControlClick(
  1615. ControlRef inControl,
  1616. Point inWhere,
  1617. EventModifiers inModifiers,
  1618. ControlActionUPP inAction) /* can be NULL */ THREEWORDINLINE(0x303C, 0x000A, 0xAA73);
  1619. /* Contextual Menu support in the Control Manager is only available on Carbon. */
  1620. /* If the control didn't display a contextual menu (possibly because the point */
  1621. /* was in a non-interesting part), the menuDisplayed output parameter will be */
  1622. /* false. If the control did display a menu, menuDisplayed will be true. */
  1623. /* This in on Carbon only */
  1624. /*
  1625. * HandleControlContextualMenuClick()
  1626. *
  1627. * Availability:
  1628. * Non-Carbon CFM: in ControlsLib 9.0 and later
  1629. * CarbonLib: in CarbonLib 1.0 and later
  1630. * Mac OS X: in version 10.0 and later
  1631. */
  1632. EXTERN_API( OSStatus )
  1633. HandleControlContextualMenuClick(
  1634. ControlRef inControl,
  1635. Point inWhere,
  1636. Boolean * menuDisplayed);
  1637. /* Some complex controls (like Data Browser) require proper sequencing of */
  1638. /* window activation and click processing. In some cases, the control might */
  1639. /* want the window to be left inactive yet still handle the click, or vice- */
  1640. /* versa. The GetControlClickActivation routine lets a control client ask the */
  1641. /* control how it wishes to behave for a particular click. */
  1642. /* This in on Carbon only. */
  1643. /*
  1644. * GetControlClickActivation()
  1645. *
  1646. * Availability:
  1647. * Non-Carbon CFM: in ControlsLib 9.0 and later
  1648. * CarbonLib: in CarbonLib 1.0 and later
  1649. * Mac OS X: in version 10.0 and later
  1650. */
  1651. EXTERN_API( OSStatus )
  1652. GetControlClickActivation(
  1653. ControlRef inControl,
  1654. Point inWhere,
  1655. EventModifiers inModifiers,
  1656. ClickActivationResult * outResult);
  1657. /*--------------------------------------------------------------------------------------*/
  1658. /* o Control Events (available only with Appearance 1.0 and later) */
  1659. /*--------------------------------------------------------------------------------------*/
  1660. /*
  1661. * HandleControlKey()
  1662. *
  1663. * Availability:
  1664. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1665. * CarbonLib: in CarbonLib 1.0 and later
  1666. * Mac OS X: in version 10.0 and later
  1667. */
  1668. EXTERN_API( ControlPartCode )
  1669. HandleControlKey(
  1670. ControlRef inControl,
  1671. SInt16 inKeyCode,
  1672. SInt16 inCharCode,
  1673. EventModifiers inModifiers) THREEWORDINLINE(0x303C, 0x000B, 0xAA73);
  1674. /*
  1675. * IdleControls()
  1676. *
  1677. * Availability:
  1678. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  1679. * CarbonLib: in CarbonLib 1.0 and later
  1680. * Mac OS X: in version 10.0 and later
  1681. */
  1682. EXTERN_API( void )
  1683. IdleControls(WindowRef inWindow) THREEWORDINLINE(0x303C, 0x000C, 0xAA73);
  1684. /*--------------------------------------------------------------------------------------*/
  1685. /* o Control Mouse Tracking (available with Carbon) */
  1686. /*--------------------------------------------------------------------------------------*/
  1687. /* The HandleControlSetCursor routine requests that a given control set the cursor to */
  1688. /* something appropriate based on the mouse location. */
  1689. /* If the control didn't want to set the cursor (because the point was in a */
  1690. /* non-interesting part), the cursorWasSet output parameter will be false. If the */
  1691. /* control did set the cursor, cursorWasSet will be true. */
  1692. /* Carbon only. */
  1693. /*
  1694. * HandleControlSetCursor()
  1695. *
  1696. * Availability:
  1697. * Non-Carbon CFM: in ControlsLib 9.0 and later
  1698. * CarbonLib: in CarbonLib 1.0 and later
  1699. * Mac OS X: in version 10.0 and later
  1700. */
  1701. EXTERN_API( OSStatus )
  1702. HandleControlSetCursor(
  1703. ControlRef control,
  1704. Point localPoint,
  1705. EventModifiers modifiers,
  1706. Boolean * cursorWasSet);
  1707. /*--------------------------------------------------------------------------------------*/
  1708. /* o Control Positioning */
  1709. /*--------------------------------------------------------------------------------------*/
  1710. /*
  1711. * MoveControl()
  1712. *
  1713. * Availability:
  1714. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1715. * CarbonLib: in CarbonLib 1.0 and later
  1716. * Mac OS X: in version 10.0 and later
  1717. */
  1718. EXTERN_API( void )
  1719. MoveControl(
  1720. ControlRef theControl,
  1721. SInt16 h,
  1722. SInt16 v) ONEWORDINLINE(0xA959);
  1723. /*
  1724. * SizeControl()
  1725. *
  1726. * Availability:
  1727. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1728. * CarbonLib: in CarbonLib 1.0 and later
  1729. * Mac OS X: in version 10.0 and later
  1730. */
  1731. EXTERN_API( void )
  1732. SizeControl(
  1733. ControlRef theControl,
  1734. SInt16 w,
  1735. SInt16 h) ONEWORDINLINE(0xA95C);
  1736. /*--------------------------------------------------------------------------------------*/
  1737. /* o Control Title */
  1738. /*--------------------------------------------------------------------------------------*/
  1739. /*
  1740. * SetControlTitle()
  1741. *
  1742. * Availability:
  1743. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1744. * CarbonLib: in CarbonLib 1.0 and later
  1745. * Mac OS X: in version 10.0 and later
  1746. */
  1747. EXTERN_API( void )
  1748. SetControlTitle(
  1749. ControlRef theControl,
  1750. ConstStr255Param title) ONEWORDINLINE(0xA95F);
  1751. /*
  1752. * GetControlTitle()
  1753. *
  1754. * Availability:
  1755. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1756. * CarbonLib: in CarbonLib 1.0 and later
  1757. * Mac OS X: in version 10.0 and later
  1758. */
  1759. EXTERN_API( void )
  1760. GetControlTitle(
  1761. ControlRef theControl,
  1762. Str255 title) ONEWORDINLINE(0xA95E);
  1763. /*--------------------------------------------------------------------------------------*/
  1764. /* o Control Value */
  1765. /*--------------------------------------------------------------------------------------*/
  1766. /*
  1767. * GetControlValue()
  1768. *
  1769. * Availability:
  1770. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1771. * CarbonLib: in CarbonLib 1.0 and later
  1772. * Mac OS X: in version 10.0 and later
  1773. */
  1774. EXTERN_API( SInt16 )
  1775. GetControlValue(ControlRef theControl) ONEWORDINLINE(0xA960);
  1776. /*
  1777. * SetControlValue()
  1778. *
  1779. * Availability:
  1780. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1781. * CarbonLib: in CarbonLib 1.0 and later
  1782. * Mac OS X: in version 10.0 and later
  1783. */
  1784. EXTERN_API( void )
  1785. SetControlValue(
  1786. ControlRef theControl,
  1787. SInt16 newValue) ONEWORDINLINE(0xA963);
  1788. /*
  1789. * GetControlMinimum()
  1790. *
  1791. * Availability:
  1792. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1793. * CarbonLib: in CarbonLib 1.0 and later
  1794. * Mac OS X: in version 10.0 and later
  1795. */
  1796. EXTERN_API( SInt16 )
  1797. GetControlMinimum(ControlRef theControl) ONEWORDINLINE(0xA961);
  1798. /*
  1799. * SetControlMinimum()
  1800. *
  1801. * Availability:
  1802. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1803. * CarbonLib: in CarbonLib 1.0 and later
  1804. * Mac OS X: in version 10.0 and later
  1805. */
  1806. EXTERN_API( void )
  1807. SetControlMinimum(
  1808. ControlRef theControl,
  1809. SInt16 newMinimum) ONEWORDINLINE(0xA964);
  1810. /*
  1811. * GetControlMaximum()
  1812. *
  1813. * Availability:
  1814. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1815. * CarbonLib: in CarbonLib 1.0 and later
  1816. * Mac OS X: in version 10.0 and later
  1817. */
  1818. EXTERN_API( SInt16 )
  1819. GetControlMaximum(ControlRef theControl) ONEWORDINLINE(0xA962);
  1820. /*
  1821. * SetControlMaximum()
  1822. *
  1823. * Availability:
  1824. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1825. * CarbonLib: in CarbonLib 1.0 and later
  1826. * Mac OS X: in version 10.0 and later
  1827. */
  1828. EXTERN_API( void )
  1829. SetControlMaximum(
  1830. ControlRef theControl,
  1831. SInt16 newMaximum) ONEWORDINLINE(0xA965);
  1832. /* proportional scrolling/32-bit value support is new with Appearance 1.1*/
  1833. /*
  1834. * GetControlViewSize()
  1835. *
  1836. * Availability:
  1837. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1838. * CarbonLib: in CarbonLib 1.0 and later
  1839. * Mac OS X: in version 10.0 and later
  1840. */
  1841. EXTERN_API( SInt32 )
  1842. GetControlViewSize(ControlRef theControl);
  1843. /*
  1844. * SetControlViewSize()
  1845. *
  1846. * Availability:
  1847. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1848. * CarbonLib: in CarbonLib 1.0 and later
  1849. * Mac OS X: in version 10.0 and later
  1850. */
  1851. EXTERN_API( void )
  1852. SetControlViewSize(
  1853. ControlRef theControl,
  1854. SInt32 newViewSize);
  1855. /*
  1856. * GetControl32BitValue()
  1857. *
  1858. * Availability:
  1859. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1860. * CarbonLib: in CarbonLib 1.0 and later
  1861. * Mac OS X: in version 10.0 and later
  1862. */
  1863. EXTERN_API( SInt32 )
  1864. GetControl32BitValue(ControlRef theControl);
  1865. /*
  1866. * SetControl32BitValue()
  1867. *
  1868. * Availability:
  1869. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1870. * CarbonLib: in CarbonLib 1.0 and later
  1871. * Mac OS X: in version 10.0 and later
  1872. */
  1873. EXTERN_API( void )
  1874. SetControl32BitValue(
  1875. ControlRef theControl,
  1876. SInt32 newValue);
  1877. /*
  1878. * GetControl32BitMaximum()
  1879. *
  1880. * Availability:
  1881. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1882. * CarbonLib: in CarbonLib 1.0 and later
  1883. * Mac OS X: in version 10.0 and later
  1884. */
  1885. EXTERN_API( SInt32 )
  1886. GetControl32BitMaximum(ControlRef theControl);
  1887. /*
  1888. * SetControl32BitMaximum()
  1889. *
  1890. * Availability:
  1891. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1892. * CarbonLib: in CarbonLib 1.0 and later
  1893. * Mac OS X: in version 10.0 and later
  1894. */
  1895. EXTERN_API( void )
  1896. SetControl32BitMaximum(
  1897. ControlRef theControl,
  1898. SInt32 newMaximum);
  1899. /*
  1900. * GetControl32BitMinimum()
  1901. *
  1902. * Availability:
  1903. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1904. * CarbonLib: in CarbonLib 1.0 and later
  1905. * Mac OS X: in version 10.0 and later
  1906. */
  1907. EXTERN_API( SInt32 )
  1908. GetControl32BitMinimum(ControlRef theControl);
  1909. /*
  1910. * SetControl32BitMinimum()
  1911. *
  1912. * Availability:
  1913. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1914. * CarbonLib: in CarbonLib 1.0 and later
  1915. * Mac OS X: in version 10.0 and later
  1916. */
  1917. EXTERN_API( void )
  1918. SetControl32BitMinimum(
  1919. ControlRef theControl,
  1920. SInt32 newMinimum);
  1921. /*
  1922. IsValidControlHandle will tell you if the handle you pass in belongs to a control
  1923. the Control Manager knows about. It does not sanity check the data in the control.
  1924. */
  1925. /*
  1926. * IsValidControlHandle()
  1927. *
  1928. * Availability:
  1929. * Non-Carbon CFM: in ControlsLib 8.5 and later
  1930. * CarbonLib: in CarbonLib 1.0 and later
  1931. * Mac OS X: in version 10.0 and later
  1932. */
  1933. EXTERN_API( Boolean )
  1934. IsValidControlHandle(ControlRef theControl);
  1935. /*--------------------------------------------------------------------------------------*/
  1936. /* o Control IDs */
  1937. /* Carbon only. */
  1938. /*--------------------------------------------------------------------------------------*/
  1939. struct ControlID {
  1940. OSType signature;
  1941. SInt32 id;
  1942. };
  1943. typedef struct ControlID ControlID;
  1944. /*
  1945. * SetControlID()
  1946. *
  1947. * Availability:
  1948. * Non-Carbon CFM: not available
  1949. * CarbonLib: in CarbonLib 1.0 and later
  1950. * Mac OS X: in version 10.0 and later
  1951. */
  1952. EXTERN_API( OSStatus )
  1953. SetControlID(
  1954. ControlRef inControl,
  1955. const ControlID * inID);
  1956. /*
  1957. * GetControlID()
  1958. *
  1959. * Availability:
  1960. * Non-Carbon CFM: not available
  1961. * CarbonLib: in CarbonLib 1.0 and later
  1962. * Mac OS X: in version 10.0 and later
  1963. */
  1964. EXTERN_API( OSStatus )
  1965. GetControlID(
  1966. ControlRef inControl,
  1967. ControlID * outID);
  1968. /*
  1969. * GetControlByID()
  1970. *
  1971. * Availability:
  1972. * Non-Carbon CFM: not available
  1973. * CarbonLib: in CarbonLib 1.0 and later
  1974. * Mac OS X: in version 10.0 and later
  1975. */
  1976. EXTERN_API( OSStatus )
  1977. GetControlByID(
  1978. WindowRef inWindow,
  1979. const ControlID * inID,
  1980. ControlRef * outControl);
  1981. /*--------------------------------------------------------------------------------------*/
  1982. /* o Control Command IDs */
  1983. /* Carbon only. */
  1984. /*--------------------------------------------------------------------------------------*/
  1985. /*--------------------------------------------------------------------------------------*/
  1986. /* o Control Identification */
  1987. /* Carbon only. */
  1988. /*--------------------------------------------------------------------------------------*/
  1989. /*--------------------------------------------------------------------------------------*/
  1990. /* o Properties */
  1991. /*--------------------------------------------------------------------------------------*/
  1992. enum {
  1993. kControlPropertyPersistent = 0x00000001 /* whether this property gets saved when flattening the control*/
  1994. };
  1995. /*
  1996. * GetControlProperty()
  1997. *
  1998. * Availability:
  1999. * Non-Carbon CFM: in ControlsLib 8.5 and later
  2000. * CarbonLib: in CarbonLib 1.0 and later
  2001. * Mac OS X: in version 10.0 and later
  2002. */
  2003. EXTERN_API( OSStatus )
  2004. GetControlProperty(
  2005. ControlRef control,
  2006. OSType propertyCreator,
  2007. OSType propertyTag,
  2008. UInt32 bufferSize,
  2009. UInt32 * actualSize, /* can be NULL */
  2010. void * propertyBuffer);
  2011. /*
  2012. * GetControlPropertySize()
  2013. *
  2014. * Availability:
  2015. * Non-Carbon CFM: in ControlsLib 8.5 and later
  2016. * CarbonLib: in CarbonLib 1.0 and later
  2017. * Mac OS X: in version 10.0 and later
  2018. */
  2019. EXTERN_API( OSStatus )
  2020. GetControlPropertySize(
  2021. ControlRef control,
  2022. OSType propertyCreator,
  2023. OSType propertyTag,
  2024. UInt32 * size);
  2025. /*
  2026. * SetControlProperty()
  2027. *
  2028. * Availability:
  2029. * Non-Carbon CFM: in ControlsLib 8.5 and later
  2030. * CarbonLib: in CarbonLib 1.0 and later
  2031. * Mac OS X: in version 10.0 and later
  2032. */
  2033. EXTERN_API( OSStatus )
  2034. SetControlProperty(
  2035. ControlRef control,
  2036. OSType propertyCreator,
  2037. OSType propertyTag,
  2038. UInt32 propertySize,
  2039. const void * propertyData);
  2040. /*
  2041. * RemoveControlProperty()
  2042. *
  2043. * Availability:
  2044. * Non-Carbon CFM: in ControlsLib 8.5 and later
  2045. * CarbonLib: in CarbonLib 1.0 and later
  2046. * Mac OS X: in version 10.0 and later
  2047. */
  2048. EXTERN_API( OSStatus )
  2049. RemoveControlProperty(
  2050. ControlRef control,
  2051. OSType propertyCreator,
  2052. OSType propertyTag);
  2053. /*
  2054. * GetControlPropertyAttributes()
  2055. *
  2056. * Availability:
  2057. * Non-Carbon CFM: not available
  2058. * CarbonLib: in CarbonLib 1.0 and later
  2059. * Mac OS X: in version 10.0 and later
  2060. */
  2061. EXTERN_API( OSStatus )
  2062. GetControlPropertyAttributes(
  2063. ControlRef control,
  2064. OSType propertyCreator,
  2065. OSType propertyTag,
  2066. UInt32 * attributes);
  2067. /*
  2068. * ChangeControlPropertyAttributes()
  2069. *
  2070. * Availability:
  2071. * Non-Carbon CFM: not available
  2072. * CarbonLib: in CarbonLib 1.0 and later
  2073. * Mac OS X: in version 10.0 and later
  2074. */
  2075. EXTERN_API( OSStatus )
  2076. ChangeControlPropertyAttributes(
  2077. ControlRef control,
  2078. OSType propertyCreator,
  2079. OSType propertyTag,
  2080. UInt32 attributesToSet,
  2081. UInt32 attributesToClear);
  2082. /*--------------------------------------------------------------------------------------*/
  2083. /* o Control Regions (Appearance 1.1 or later) */
  2084. /* */
  2085. /* See the discussion on meta-parts in this header for more information */
  2086. /*--------------------------------------------------------------------------------------*/
  2087. /*
  2088. * GetControlRegion()
  2089. *
  2090. * Availability:
  2091. * Non-Carbon CFM: in ControlsLib 8.5 and later
  2092. * CarbonLib: in CarbonLib 1.0 and later
  2093. * Mac OS X: in version 10.0 and later
  2094. */
  2095. EXTERN_API( OSStatus )
  2096. GetControlRegion(
  2097. ControlRef inControl,
  2098. ControlPartCode inPart,
  2099. RgnHandle outRegion);
  2100. /*--------------------------------------------------------------------------------------*/
  2101. /* o Control Variant */
  2102. /*--------------------------------------------------------------------------------------*/
  2103. /*
  2104. * GetControlVariant()
  2105. *
  2106. * Availability:
  2107. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2108. * CarbonLib: in CarbonLib 1.0 and later
  2109. * Mac OS X: in version 10.0 and later
  2110. */
  2111. EXTERN_API( ControlVariant )
  2112. GetControlVariant(ControlRef theControl) ONEWORDINLINE(0xA809);
  2113. /*--------------------------------------------------------------------------------------*/
  2114. /* o Control Action */
  2115. /*--------------------------------------------------------------------------------------*/
  2116. /*
  2117. * SetControlAction()
  2118. *
  2119. * Availability:
  2120. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2121. * CarbonLib: in CarbonLib 1.0 and later
  2122. * Mac OS X: in version 10.0 and later
  2123. */
  2124. EXTERN_API( void )
  2125. SetControlAction(
  2126. ControlRef theControl,
  2127. ControlActionUPP actionProc) ONEWORDINLINE(0xA96B);
  2128. /*
  2129. * GetControlAction()
  2130. *
  2131. * Availability:
  2132. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2133. * CarbonLib: in CarbonLib 1.0 and later
  2134. * Mac OS X: in version 10.0 and later
  2135. */
  2136. EXTERN_API( ControlActionUPP )
  2137. GetControlAction(ControlRef theControl) ONEWORDINLINE(0xA96A);
  2138. /*--------------------------------------------------------------------------------------*/
  2139. /* o Control Accessors */
  2140. /*--------------------------------------------------------------------------------------*/
  2141. /*
  2142. * SetControlReference()
  2143. *
  2144. * Availability:
  2145. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2146. * CarbonLib: in CarbonLib 1.0 and later
  2147. * Mac OS X: in version 10.0 and later
  2148. */
  2149. EXTERN_API( void )
  2150. SetControlReference(
  2151. ControlRef theControl,
  2152. SInt32 data) ONEWORDINLINE(0xA95B);
  2153. /*
  2154. * GetControlReference()
  2155. *
  2156. * Availability:
  2157. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2158. * CarbonLib: in CarbonLib 1.0 and later
  2159. * Mac OS X: in version 10.0 and later
  2160. */
  2161. EXTERN_API( SInt32 )
  2162. GetControlReference(ControlRef theControl) ONEWORDINLINE(0xA95A);
  2163. #if !OPAQUE_TOOLBOX_STRUCTS
  2164. #if CALL_NOT_IN_CARBON
  2165. /*
  2166. * GetAuxiliaryControlRecord()
  2167. *
  2168. * Availability:
  2169. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2170. * CarbonLib: not available
  2171. * Mac OS X: not available
  2172. */
  2173. EXTERN_API( Boolean )
  2174. GetAuxiliaryControlRecord(
  2175. ControlRef theControl,
  2176. AuxCtlHandle * acHndl) ONEWORDINLINE(0xAA44);
  2177. #endif /* CALL_NOT_IN_CARBON */
  2178. #endif /* !OPAQUE_TOOLBOX_STRUCTS */
  2179. #if CALL_NOT_IN_CARBON
  2180. /*
  2181. * SetControlColor()
  2182. *
  2183. * Availability:
  2184. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2185. * CarbonLib: not available
  2186. * Mac OS X: not available
  2187. */
  2188. EXTERN_API( void )
  2189. SetControlColor(
  2190. ControlRef theControl,
  2191. CCTabHandle newColorTable) ONEWORDINLINE(0xAA43);
  2192. /*--------------------------------------------------------------------------------------*/
  2193. /* o Control Hierarchy (Appearance 1.0 and later only) */
  2194. /*--------------------------------------------------------------------------------------*/
  2195. #endif /* CALL_NOT_IN_CARBON */
  2196. /*
  2197. * SendControlMessage()
  2198. *
  2199. * Availability:
  2200. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2201. * CarbonLib: in CarbonLib 1.0 and later
  2202. * Mac OS X: in version 10.0 and later
  2203. */
  2204. EXTERN_API( SInt32 )
  2205. SendControlMessage(
  2206. ControlRef inControl,
  2207. SInt16 inMessage,
  2208. void * inParam) THREEWORDINLINE(0x303C, 0xFFFE, 0xAA73);
  2209. /*
  2210. * DumpControlHierarchy()
  2211. *
  2212. * Availability:
  2213. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2214. * CarbonLib: in CarbonLib 1.0 and later
  2215. * Mac OS X: in version 10.0 and later
  2216. */
  2217. EXTERN_API( OSErr )
  2218. DumpControlHierarchy(
  2219. WindowRef inWindow,
  2220. const FSSpec * inDumpFile) THREEWORDINLINE(0x303C, 0xFFFF, 0xAA73);
  2221. /*
  2222. * CreateRootControl()
  2223. *
  2224. * Summary:
  2225. * Creates a new root control for a window.
  2226. *
  2227. * Parameters:
  2228. *
  2229. * inWindow:
  2230. * The window for which to create a root control.
  2231. *
  2232. * outControl:
  2233. * On exit, contains the window's root control. In Mac OS 10.1 and
  2234. * CarbonLib 1.5 and later, this parameter may be NULL if you
  2235. * don't need the ControlRef.
  2236. *
  2237. * Result:
  2238. * A result code indicating success or failure. errRootAlreadyExists
  2239. * is returned if the window already has a root control.
  2240. *
  2241. * Availability:
  2242. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2243. * CarbonLib: in CarbonLib 1.0 and later
  2244. * Mac OS X: in version 10.0 and later
  2245. */
  2246. EXTERN_API( OSErr )
  2247. CreateRootControl(
  2248. WindowRef inWindow,
  2249. ControlRef * outControl) /* can be NULL */ THREEWORDINLINE(0x303C, 0x0001, 0xAA73);
  2250. /*
  2251. * GetRootControl()
  2252. *
  2253. * Availability:
  2254. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2255. * CarbonLib: in CarbonLib 1.0 and later
  2256. * Mac OS X: in version 10.0 and later
  2257. */
  2258. EXTERN_API( OSErr )
  2259. GetRootControl(
  2260. WindowRef inWindow,
  2261. ControlRef * outControl) THREEWORDINLINE(0x303C, 0x0002, 0xAA73);
  2262. /*
  2263. * EmbedControl()
  2264. *
  2265. * Availability:
  2266. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2267. * CarbonLib: in CarbonLib 1.0 and later
  2268. * Mac OS X: in version 10.0 and later
  2269. */
  2270. EXTERN_API( OSErr )
  2271. EmbedControl(
  2272. ControlRef inControl,
  2273. ControlRef inContainer) THREEWORDINLINE(0x303C, 0x0003, 0xAA73);
  2274. /*
  2275. * AutoEmbedControl()
  2276. *
  2277. * Availability:
  2278. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2279. * CarbonLib: in CarbonLib 1.0 and later
  2280. * Mac OS X: in version 10.0 and later
  2281. */
  2282. EXTERN_API( OSErr )
  2283. AutoEmbedControl(
  2284. ControlRef inControl,
  2285. WindowRef inWindow) THREEWORDINLINE(0x303C, 0x0004, 0xAA73);
  2286. /*
  2287. * GetSuperControl()
  2288. *
  2289. * Availability:
  2290. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2291. * CarbonLib: in CarbonLib 1.0 and later
  2292. * Mac OS X: in version 10.0 and later
  2293. */
  2294. EXTERN_API( OSErr )
  2295. GetSuperControl(
  2296. ControlRef inControl,
  2297. ControlRef * outParent) THREEWORDINLINE(0x303C, 0x0015, 0xAA73);
  2298. /*
  2299. * CountSubControls()
  2300. *
  2301. * Availability:
  2302. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2303. * CarbonLib: in CarbonLib 1.0 and later
  2304. * Mac OS X: in version 10.0 and later
  2305. */
  2306. EXTERN_API( OSErr )
  2307. CountSubControls(
  2308. ControlRef inControl,
  2309. UInt16 * outNumChildren) THREEWORDINLINE(0x303C, 0x0016, 0xAA73);
  2310. /*
  2311. * GetIndexedSubControl()
  2312. *
  2313. * Availability:
  2314. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2315. * CarbonLib: in CarbonLib 1.0 and later
  2316. * Mac OS X: in version 10.0 and later
  2317. */
  2318. EXTERN_API( OSErr )
  2319. GetIndexedSubControl(
  2320. ControlRef inControl,
  2321. UInt16 inIndex,
  2322. ControlRef * outSubControl) THREEWORDINLINE(0x303C, 0x0017, 0xAA73);
  2323. /*
  2324. * SetControlSupervisor()
  2325. *
  2326. * Availability:
  2327. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2328. * CarbonLib: in CarbonLib 1.0 and later
  2329. * Mac OS X: in version 10.0 and later
  2330. */
  2331. EXTERN_API( OSErr )
  2332. SetControlSupervisor(
  2333. ControlRef inControl,
  2334. ControlRef inBoss) THREEWORDINLINE(0x303C, 0x001A, 0xAA73);
  2335. /*--------------------------------------------------------------------------------------*/
  2336. /* o Keyboard Focus (available only with Appearance 1.0 and later) */
  2337. /*--------------------------------------------------------------------------------------*/
  2338. /*
  2339. * GetKeyboardFocus()
  2340. *
  2341. * Discussion:
  2342. * Passes back the currently focused control within the given window.
  2343. *
  2344. * Parameters:
  2345. *
  2346. * inWindow:
  2347. * The window to get the focus of.
  2348. *
  2349. * outControl:
  2350. * On output, this will contain the ControlRef that is currently
  2351. * focused in the given window. If there is no currently focused
  2352. * control, outControl will contain NULL.
  2353. *
  2354. * Result:
  2355. * An operating system result code.
  2356. *
  2357. * Availability:
  2358. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2359. * CarbonLib: in CarbonLib 1.0 and later
  2360. * Mac OS X: in version 10.0 and later
  2361. */
  2362. EXTERN_API( OSErr )
  2363. GetKeyboardFocus(
  2364. WindowRef inWindow,
  2365. ControlRef * outControl) THREEWORDINLINE(0x303C, 0x000D, 0xAA73);
  2366. /*
  2367. * SetKeyboardFocus()
  2368. *
  2369. * Discussion:
  2370. * Focuses the given part of the given control in a particular
  2371. * window. If another control is currently focused in the window,
  2372. * focus will be removed from the other control before focus is
  2373. * given to the desired control. SetKeyboardFocus respects the full
  2374. * keyboard navigation mode.
  2375. *
  2376. * Parameters:
  2377. *
  2378. * inWindow:
  2379. * The window which contains the control you want to focus. If the
  2380. * window does not contain the control, an error will be returned.
  2381. *
  2382. * inControl:
  2383. * The control you want to focus.
  2384. *
  2385. * inPart:
  2386. * The part of the control you wish to focus. You may pass
  2387. * kControlFocusNoPart to clear the focus in the given control.
  2388. * You may pass kControlFocusNextPart or kControlFocusPrevPart to
  2389. * move the focus within the given control.
  2390. *
  2391. * Result:
  2392. * An operating system result code.
  2393. *
  2394. * Availability:
  2395. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2396. * CarbonLib: in CarbonLib 1.0 and later
  2397. * Mac OS X: in version 10.0 and later
  2398. */
  2399. EXTERN_API( OSErr )
  2400. SetKeyboardFocus(
  2401. WindowRef inWindow,
  2402. ControlRef inControl,
  2403. ControlFocusPart inPart) THREEWORDINLINE(0x303C, 0x000E, 0xAA73);
  2404. /*
  2405. * AdvanceKeyboardFocus()
  2406. *
  2407. * Discussion:
  2408. * Advances the focus to the next most appropriate control. Unless
  2409. * overriden in some fashion (either by overriding certain carbon
  2410. * events or using the HIViewSetNextFocus API), the Toolbox will use
  2411. * a spacially determinant method of focusing, attempting to focus
  2412. * left to right, top to bottom in a window, taking groups of
  2413. * controls into account. AdvanceKeyboardFocus does not respect the
  2414. * full keyboard navigation mode. It will only advance the focus
  2415. * between traditionally focusable controls. If you want to advance
  2416. * the focus in a way that respects the full keyboard navigation
  2417. * mode, use the HIViewAdvanceFocus API.
  2418. *
  2419. * Parameters:
  2420. *
  2421. * inWindow:
  2422. * The window to advance the focus in.
  2423. *
  2424. * Result:
  2425. * An operating system result code.
  2426. *
  2427. * Availability:
  2428. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2429. * CarbonLib: in CarbonLib 1.0 and later
  2430. * Mac OS X: in version 10.0 and later
  2431. */
  2432. EXTERN_API( OSErr )
  2433. AdvanceKeyboardFocus(WindowRef inWindow) THREEWORDINLINE(0x303C, 0x000F, 0xAA73);
  2434. /*
  2435. * ReverseKeyboardFocus()
  2436. *
  2437. * Discussion:
  2438. * Reverses the focus to the next most appropriate control. Unless
  2439. * overriden in some fashion (either by overriding certain carbon
  2440. * events or using the HIViewSetNextFocus API), the Toolbox will use
  2441. * a spacially determinant method of focusing, attempting to focus
  2442. * left to right, top to bottom in a window, taking groups of
  2443. * controls into account. ReverseKeyboardFocus does not respect the
  2444. * full keyboard navigation mode. It will only reverse the focus
  2445. * between traditionally focusable controls. If you want to reverse
  2446. * the focus in a way that respects the full keyboard navigation
  2447. * mode, use the HIViewAdvanceFocus API.
  2448. *
  2449. * Parameters:
  2450. *
  2451. * inWindow:
  2452. * The window to reverse the focus in.
  2453. *
  2454. * Result:
  2455. * An operating system result code.
  2456. *
  2457. * Availability:
  2458. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2459. * CarbonLib: in CarbonLib 1.0 and later
  2460. * Mac OS X: in version 10.0 and later
  2461. */
  2462. EXTERN_API( OSErr )
  2463. ReverseKeyboardFocus(WindowRef inWindow) THREEWORDINLINE(0x303C, 0x0010, 0xAA73);
  2464. /*
  2465. * ClearKeyboardFocus()
  2466. *
  2467. * Discussion:
  2468. * Clears focus from the currently focused control in a given
  2469. * window. The window will be left such that no control is focused
  2470. * within it.
  2471. *
  2472. * Parameters:
  2473. *
  2474. * inWindow:
  2475. * The window that you want to clear the focus in.
  2476. *
  2477. * Result:
  2478. * An operating system result code.
  2479. *
  2480. * Availability:
  2481. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2482. * CarbonLib: in CarbonLib 1.0 and later
  2483. * Mac OS X: in version 10.0 and later
  2484. */
  2485. EXTERN_API( OSErr )
  2486. ClearKeyboardFocus(WindowRef inWindow) THREEWORDINLINE(0x303C, 0x0019, 0xAA73);
  2487. /*--------------------------------------------------------------------------------------*/
  2488. /* o Control Data (available only with Appearance 1.0 and later) */
  2489. /*--------------------------------------------------------------------------------------*/
  2490. /*
  2491. * GetControlFeatures()
  2492. *
  2493. * Availability:
  2494. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2495. * CarbonLib: in CarbonLib 1.0 and later
  2496. * Mac OS X: in version 10.0 and later
  2497. */
  2498. EXTERN_API( OSErr )
  2499. GetControlFeatures(
  2500. ControlRef inControl,
  2501. UInt32 * outFeatures) THREEWORDINLINE(0x303C, 0x0011, 0xAA73);
  2502. /*
  2503. * SetControlData()
  2504. *
  2505. * Availability:
  2506. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2507. * CarbonLib: in CarbonLib 1.0 and later
  2508. * Mac OS X: in version 10.0 and later
  2509. */
  2510. EXTERN_API( OSErr )
  2511. SetControlData(
  2512. ControlRef inControl,
  2513. ControlPartCode inPart,
  2514. ResType inTagName,
  2515. Size inSize,
  2516. const void * inData) THREEWORDINLINE(0x303C, 0x0012, 0xAA73);
  2517. /*
  2518. * GetControlData()
  2519. *
  2520. * Availability:
  2521. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2522. * CarbonLib: in CarbonLib 1.0 and later
  2523. * Mac OS X: in version 10.0 and later
  2524. */
  2525. EXTERN_API( OSErr )
  2526. GetControlData(
  2527. ControlRef inControl,
  2528. ControlPartCode inPart,
  2529. ResType inTagName,
  2530. Size inBufferSize,
  2531. void * inBuffer,
  2532. Size * outActualSize) /* can be NULL */ THREEWORDINLINE(0x303C, 0x0013, 0xAA73);
  2533. /*
  2534. * GetControlDataSize()
  2535. *
  2536. * Availability:
  2537. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2538. * CarbonLib: in CarbonLib 1.0 and later
  2539. * Mac OS X: in version 10.0 and later
  2540. */
  2541. EXTERN_API( OSErr )
  2542. GetControlDataSize(
  2543. ControlRef inControl,
  2544. ControlPartCode inPart,
  2545. ResType inTagName,
  2546. Size * outMaxSize) THREEWORDINLINE(0x303C, 0x0014, 0xAA73);
  2547. /*--------------------------------------------------------------------------------------*/
  2548. /* o Control Drag & Drop */
  2549. /* Carbon only. */
  2550. /*--------------------------------------------------------------------------------------*/
  2551. /*
  2552. * Discussion:
  2553. * DragTrackingMessage values for use with HandleControlDragTracking.
  2554. */
  2555. enum {
  2556. /*
  2557. * The drag was previously outside the control and it just now
  2558. * entered the control.
  2559. */
  2560. kDragTrackingEnterControl = 2,
  2561. /*
  2562. * The drag was previously inside the control and it is still inside
  2563. * the control.
  2564. */
  2565. kDragTrackingInControl = 3,
  2566. /*
  2567. * The drag was previously inside the control and it just now left
  2568. * the control.
  2569. */
  2570. kDragTrackingLeaveControl = 4
  2571. };
  2572. /*
  2573. * HandleControlDragTracking()
  2574. *
  2575. * Summary:
  2576. * Tells a control to respond visually to a drag.
  2577. *
  2578. * Discussion:
  2579. * Call HandleControlDragTracking when a drag is above a control in
  2580. * your window and you want to give that control a chance to draw
  2581. * appropriately in response to the drag. Note that in order for a
  2582. * control to have any chance of responding to this API, you must
  2583. * enable the control's drag and drop support with
  2584. * SetControlDragTrackingEnabled.
  2585. *
  2586. * Parameters:
  2587. *
  2588. * inControl:
  2589. * The control the drag is over. Most controls won't track drags
  2590. * unless you enable drag tracking on it with
  2591. * SetControlDragTrackingEnabled.
  2592. *
  2593. * inMessage:
  2594. * A drag message indicating the state of the drag above the
  2595. * control. The meaning of the value you pass in must be relative
  2596. * to the control, not the whole window. For when the drag first
  2597. * enters the control, you should pass kDragTrackingEnterControl.
  2598. * While the drag stays within the control, pass
  2599. * kDragTrackingInControl. When the drag leaves the control, pass
  2600. * kDragTrackingLeaveControl.
  2601. *
  2602. * inDrag:
  2603. * The drag reference that is over the control.
  2604. *
  2605. * outLikesDrag:
  2606. * On output, this will be a boolean indicating whether the
  2607. * control "likes" the drag. A control "likes" the drag if the
  2608. * data in the drag ref can be accepted by the control. If the
  2609. * control does not like the drag, don't bother calling
  2610. * HandleControlDragReceive if the user drops the dragged object
  2611. * onto the control.
  2612. *
  2613. * Result:
  2614. * A result code indicating success or failure.
  2615. *
  2616. * Availability:
  2617. * Non-Carbon CFM: in ControlsLib 9.0 and later
  2618. * CarbonLib: in CarbonLib 1.0 and later
  2619. * Mac OS X: in version 10.0 and later
  2620. */
  2621. EXTERN_API( OSStatus )
  2622. HandleControlDragTracking(
  2623. ControlRef inControl,
  2624. DragTrackingMessage inMessage,
  2625. DragReference inDrag,
  2626. Boolean * outLikesDrag);
  2627. /*
  2628. * HandleControlDragReceive()
  2629. *
  2630. * Summary:
  2631. * Tells a control to accept the data in drag reference.
  2632. *
  2633. * Discussion:
  2634. * Call HandleControlDragReceive when the user dropped a drag on a
  2635. * control in your window. This gives the control the opportunity to
  2636. * pull any interesting data out of the drag and insert the data
  2637. * into itself. Note that in order for a control to have any chance
  2638. * of responding to this API, you must enable the control's drag and
  2639. * drop support with SetControlDragTrackingEnabled.
  2640. *
  2641. * Parameters:
  2642. *
  2643. * inControl:
  2644. * The control who should accept the data. Most controls won't
  2645. * accept drags unless you enable drag tracking on it with
  2646. * SetControlDragTrackingEnabled.
  2647. *
  2648. * inDrag:
  2649. * The drag reference that was dropped on the control.
  2650. *
  2651. * Result:
  2652. * A result code indicating success or failure.
  2653. *
  2654. * Availability:
  2655. * Non-Carbon CFM: in ControlsLib 9.0 and later
  2656. * CarbonLib: in CarbonLib 1.0 and later
  2657. * Mac OS X: in version 10.0 and later
  2658. */
  2659. EXTERN_API( OSStatus )
  2660. HandleControlDragReceive(
  2661. ControlRef inControl,
  2662. DragReference inDrag);
  2663. /*
  2664. * SetControlDragTrackingEnabled()
  2665. *
  2666. * Summary:
  2667. * Tells a control that it should track and receive drags.
  2668. *
  2669. * Discussion:
  2670. * Call SetControlDragTrackingEnabled to turn enable a control's
  2671. * support for drag and drop. Controls won't track drags unless you
  2672. * first turn on drag and drop support with this API. Some controls
  2673. * don't support drag and drop at all; these controls won't track or
  2674. * receive drags even if you call this API with true.
  2675. *
  2676. * Parameters:
  2677. *
  2678. * inControl:
  2679. * The control whose drag tracking enabled state you'd like to set.
  2680. *
  2681. * inTracks:
  2682. * A Boolean indicating whether you want this control to track and
  2683. * receive drags.
  2684. *
  2685. * Result:
  2686. * A result code indicating success or failure.
  2687. *
  2688. * Availability:
  2689. * Non-Carbon CFM: in ControlsLib 9.0 and later
  2690. * CarbonLib: in CarbonLib 1.0 and later
  2691. * Mac OS X: in version 10.0 and later
  2692. */
  2693. EXTERN_API( OSStatus )
  2694. SetControlDragTrackingEnabled(
  2695. ControlRef inControl,
  2696. Boolean inTracks);
  2697. /*
  2698. * IsControlDragTrackingEnabled()
  2699. *
  2700. * Summary:
  2701. * Tells you whether a control's drag track and receive support is
  2702. * enabled.
  2703. *
  2704. * Discussion:
  2705. * Call IsControlDragTrackingEnabled to query a whether a control's
  2706. * drag and drop support is enabled. Some controls don't support
  2707. * drag and drop at all; these controls won't track or receive drags
  2708. * even if you call this API and see a true output value.
  2709. *
  2710. * Parameters:
  2711. *
  2712. * inControl:
  2713. * The control whose drag tracking enabled state you'd like to
  2714. * query.
  2715. *
  2716. * outTracks:
  2717. * On output, this will contain a Boolean value whether the
  2718. * control's drag and drop support is enabled.
  2719. *
  2720. * Result:
  2721. * A result code indicating success or failure.
  2722. *
  2723. * Availability:
  2724. * Non-Carbon CFM: in ControlsLib 9.0 and later
  2725. * CarbonLib: in CarbonLib 1.0 and later
  2726. * Mac OS X: in version 10.0 and later
  2727. */
  2728. EXTERN_API( OSStatus )
  2729. IsControlDragTrackingEnabled(
  2730. ControlRef inControl,
  2731. Boolean * outTracks);
  2732. /*
  2733. * SetAutomaticControlDragTrackingEnabledForWindow()
  2734. *
  2735. * Summary:
  2736. * Enables or disables the Control Manager's automatic drag tracking
  2737. * for a given window.
  2738. *
  2739. * Discussion:
  2740. * Call SetAutomaticControlDragTrackingEnabledForWindow to turn on
  2741. * or off the Control Manager's automatic drag tracking support for
  2742. * a given window. By default, your application code is responsible
  2743. * for installing drag tracking and receive handlers on a given
  2744. * window. The Control Manager, however, has support for
  2745. * automatically tracking and receiving drags over controls. The
  2746. * Control Manager will detect the control the drag is over and call
  2747. * HandleControlDragTracking and HandleControlDragReceive
  2748. * appropriately. By default, this automatic support is turned off.
  2749. * You can turn on this support by calling
  2750. * SetAutomaticControlDragTrackingEnabledForWindow with true. Note
  2751. * that earlier versions of system software incorrectly enable this
  2752. * support by default; do not rely on this buggy behavior. As of Mac
  2753. * OS 10.1.3, Mac OS 9.2, and CarbonLib 1.4, the buggy behavior is
  2754. * fixed, and you must call this routine with true to enable
  2755. * automatic drag tracking.
  2756. *
  2757. * Parameters:
  2758. *
  2759. * inWindow:
  2760. * The window for which you'd like to enable or disable the
  2761. * Control Manager's automatic drag tracking support.
  2762. *
  2763. * inTracks:
  2764. * A Boolean value indicating whether you want to enable the
  2765. * Control Manager's automatic drag tracking support.
  2766. *
  2767. * Result:
  2768. * A result code indicating success or failure.
  2769. *
  2770. * Availability:
  2771. * Non-Carbon CFM: in ControlsLib 9.0 and later
  2772. * CarbonLib: in CarbonLib 1.0 and later
  2773. * Mac OS X: in version 10.0 and later
  2774. */
  2775. EXTERN_API( OSStatus )
  2776. SetAutomaticControlDragTrackingEnabledForWindow(
  2777. WindowRef inWindow,
  2778. Boolean inTracks);
  2779. /*
  2780. * IsAutomaticControlDragTrackingEnabledForWindow()
  2781. *
  2782. * Summary:
  2783. * Tells you whether the Control Manager's automatic drag tracking
  2784. * is enabled for a given window.
  2785. *
  2786. * Discussion:
  2787. * Call IsAutomaticControlDragTrackingEnabledForWindow to query the
  2788. * enabled state of the Control Manager's automatic drag tracking
  2789. * support for a given window. See the information on
  2790. * SetAutomaticControlDragTrackingEnabledForWindow for more details.
  2791. *
  2792. * Parameters:
  2793. *
  2794. * inWindow:
  2795. * The window whose Control Manager automatic drag tracking enable
  2796. * state you'd like to query.
  2797. *
  2798. * outTracks:
  2799. * On output, this will contain a Boolean value whether the
  2800. * Control Manager's automatic drag tracking is enabled.
  2801. *
  2802. * Result:
  2803. * A result code indicating success or failure.
  2804. *
  2805. * Availability:
  2806. * Non-Carbon CFM: in ControlsLib 9.0 and later
  2807. * CarbonLib: in CarbonLib 1.0 and later
  2808. * Mac OS X: in version 10.0 and later
  2809. */
  2810. EXTERN_API( OSStatus )
  2811. IsAutomaticControlDragTrackingEnabledForWindow(
  2812. WindowRef inWindow,
  2813. Boolean * outTracks);
  2814. #if !TARGET_OS_MAC
  2815. /*--------------------------------------------------------------------------------------*/
  2816. /* o QuickTime 3.0 Win32/unix notification mechanism */
  2817. /*--------------------------------------------------------------------------------------*/
  2818. /* Proc used to notify window that something happened to the control*/
  2819. typedef CALLBACK_API_C( void , ControlNotificationProcPtr )(WindowRef theWindow, ControlRef theControl, ControlNotification notification, long param1, long param2);
  2820. /*
  2821. Proc used to prefilter events before handled by control. A client of a control calls
  2822. CTRLSetPreFilterProc() to have the control call this proc before handling the event.
  2823. If the proc returns TRUE, the control can go ahead and handle the event.
  2824. */
  2825. typedef CALLBACK_API_C( Boolean , PreFilterEventProc )(ControlRef theControl, EventRecord *theEvent);
  2826. #if CALL_NOT_IN_CARBON
  2827. /*
  2828. * GetControlComponentInstance()
  2829. *
  2830. * Availability:
  2831. * Non-Carbon CFM: not available
  2832. * CarbonLib: not available
  2833. * Mac OS X: not available
  2834. */
  2835. EXTERN_API_C( long )
  2836. GetControlComponentInstance(ControlRef theControl);
  2837. /*
  2838. * GetControlHandleFromCookie()
  2839. *
  2840. * Availability:
  2841. * Non-Carbon CFM: not available
  2842. * CarbonLib: not available
  2843. * Mac OS X: not available
  2844. */
  2845. EXTERN_API_C( ControlRef )
  2846. GetControlHandleFromCookie(long cookie);
  2847. #define GetControlRefFromCookie GetControlHandleFromCookie
  2848. /*
  2849. * SetControlDefProc()
  2850. *
  2851. * Availability:
  2852. * Non-Carbon CFM: not available
  2853. * CarbonLib: not available
  2854. * Mac OS X: not available
  2855. */
  2856. EXTERN_API_C( void )
  2857. SetControlDefProc(
  2858. short resID,
  2859. ControlDefProcPtr proc);
  2860. #endif /* CALL_NOT_IN_CARBON */
  2861. typedef ControlNotificationProcPtr ControlNotificationUPP;
  2862. #endif /* !TARGET_OS_MAC */
  2863. /*--------------------------------------------------------------------------------------*/
  2864. /* o C Glue */
  2865. /*--------------------------------------------------------------------------------------*/
  2866. #if CALL_NOT_IN_CARBON
  2867. #if CALL_NOT_IN_CARBON
  2868. /*
  2869. * dragcontrol()
  2870. *
  2871. * Availability:
  2872. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2873. * CarbonLib: not available
  2874. * Mac OS X: not available
  2875. */
  2876. EXTERN_API_C( void )
  2877. dragcontrol(
  2878. ControlRef theControl,
  2879. Point * startPt,
  2880. const Rect * limitRect,
  2881. const Rect * slopRect,
  2882. short axis);
  2883. /*
  2884. * newcontrol()
  2885. *
  2886. * Availability:
  2887. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2888. * CarbonLib: not available
  2889. * Mac OS X: not available
  2890. */
  2891. EXTERN_API_C( ControlRef )
  2892. newcontrol(
  2893. WindowRef theWindow,
  2894. const Rect * boundsRect,
  2895. const char * title,
  2896. Boolean visible,
  2897. short value,
  2898. short min,
  2899. short max,
  2900. short procID,
  2901. long refCon);
  2902. /*
  2903. * findcontrol()
  2904. *
  2905. * Availability:
  2906. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2907. * CarbonLib: not available
  2908. * Mac OS X: not available
  2909. */
  2910. EXTERN_API_C( short )
  2911. findcontrol(
  2912. Point * thePoint,
  2913. WindowRef theWindow,
  2914. ControlRef * theControl);
  2915. /*
  2916. * getcontroltitle()
  2917. *
  2918. * Availability:
  2919. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2920. * CarbonLib: not available
  2921. * Mac OS X: not available
  2922. */
  2923. EXTERN_API_C( void )
  2924. getcontroltitle(
  2925. ControlRef theControl,
  2926. char * title);
  2927. /*
  2928. * setcontroltitle()
  2929. *
  2930. * Availability:
  2931. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2932. * CarbonLib: not available
  2933. * Mac OS X: not available
  2934. */
  2935. EXTERN_API_C( void )
  2936. setcontroltitle(
  2937. ControlRef theControl,
  2938. const char * title);
  2939. /*
  2940. * trackcontrol()
  2941. *
  2942. * Availability:
  2943. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2944. * CarbonLib: not available
  2945. * Mac OS X: not available
  2946. */
  2947. EXTERN_API_C( short )
  2948. trackcontrol(
  2949. ControlRef theControl,
  2950. Point * thePoint,
  2951. ControlActionUPP actionProc);
  2952. /*
  2953. * testcontrol()
  2954. *
  2955. * Availability:
  2956. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2957. * CarbonLib: not available
  2958. * Mac OS X: not available
  2959. */
  2960. EXTERN_API_C( short )
  2961. testcontrol(
  2962. ControlRef theControl,
  2963. Point * thePt);
  2964. #endif /* CALL_NOT_IN_CARBON */
  2965. #endif /* CALL_NOT_IN_CARBON */
  2966. #if OLDROUTINENAMES
  2967. /*--------------------------------------------------------------------------------------*/
  2968. /* o OLDROUTINENAMES */
  2969. /*--------------------------------------------------------------------------------------*/
  2970. enum {
  2971. useWFont = kControlUsesOwningWindowsFontVariant
  2972. };
  2973. enum {
  2974. inThumb = kControlIndicatorPart,
  2975. kNoHiliteControlPart = kControlNoPart,
  2976. kInIndicatorControlPart = kControlIndicatorPart,
  2977. kReservedControlPart = kControlDisabledPart,
  2978. kControlInactiveControlPart = kControlInactivePart
  2979. };
  2980. #define SetCTitle(theControl, title) SetControlTitle(theControl, title)
  2981. #define GetCTitle(theControl, title) GetControlTitle(theControl, title)
  2982. #define UpdtControl(theWindow, updateRgn) UpdateControls(theWindow, updateRgn)
  2983. #define SetCtlValue(theControl, theValue) SetControlValue(theControl, theValue)
  2984. #define GetCtlValue(theControl) GetControlValue(theControl)
  2985. #define SetCtlMin(theControl, minValue) SetControlMinimum(theControl, minValue)
  2986. #define GetCtlMin(theControl) GetControlMinimum(theControl)
  2987. #define SetCtlMax(theControl, maxValue) SetControlMaximum(theControl, maxValue)
  2988. #define GetCtlMax(theControl) GetControlMaximum(theControl)
  2989. #define GetAuxCtl(theControl, acHndl) GetAuxiliaryControlRecord(theControl, acHndl)
  2990. #define SetCRefCon(theControl, data) SetControlReference(theControl, data)
  2991. #define GetCRefCon(theControl) GetControlReference(theControl)
  2992. #define SetCtlAction(theControl, actionProc) SetControlAction(theControl, actionProc)
  2993. #define GetCtlAction(theControl) GetControlAction(theControl)
  2994. #define SetCtlColor(theControl, newColorTable) SetControlColor(theControl, newColorTable)
  2995. #define GetCVariant(theControl) GetControlVariant(theControl)
  2996. #define getctitle(theControl, title) getcontroltitle(theControl, title)
  2997. #define setctitle(theControl, title) setcontroltitle(theControl, title)
  2998. #endif /* OLDROUTINENAMES */
  2999. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  3000. /* Getters */
  3001. /*
  3002. * GetControlBounds()
  3003. *
  3004. * Availability:
  3005. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3006. * CarbonLib: in CarbonLib 1.0 and later
  3007. * Mac OS X: in version 10.0 and later
  3008. */
  3009. EXTERN_API( Rect * )
  3010. GetControlBounds(
  3011. ControlRef control,
  3012. Rect * bounds);
  3013. /*
  3014. * IsControlHilited()
  3015. *
  3016. * Availability:
  3017. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3018. * CarbonLib: in CarbonLib 1.0 and later
  3019. * Mac OS X: in version 10.0 and later
  3020. */
  3021. EXTERN_API( Boolean )
  3022. IsControlHilited(ControlRef control);
  3023. /*
  3024. * GetControlHilite()
  3025. *
  3026. * Availability:
  3027. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3028. * CarbonLib: in CarbonLib 1.0 and later
  3029. * Mac OS X: in version 10.0 and later
  3030. */
  3031. EXTERN_API( UInt16 )
  3032. GetControlHilite(ControlRef control);
  3033. /*
  3034. * GetControlOwner()
  3035. *
  3036. * Availability:
  3037. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3038. * CarbonLib: in CarbonLib 1.0 and later
  3039. * Mac OS X: in version 10.0 and later
  3040. */
  3041. EXTERN_API( WindowRef )
  3042. GetControlOwner(ControlRef control);
  3043. /*
  3044. * GetControlDataHandle()
  3045. *
  3046. * Availability:
  3047. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3048. * CarbonLib: in CarbonLib 1.0 and later
  3049. * Mac OS X: in version 10.0 and later
  3050. */
  3051. EXTERN_API( Handle )
  3052. GetControlDataHandle(ControlRef control);
  3053. /*
  3054. * GetControlPopupMenuHandle()
  3055. *
  3056. * Availability:
  3057. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3058. * CarbonLib: in CarbonLib 1.0 and later
  3059. * Mac OS X: in version 10.0 and later
  3060. */
  3061. EXTERN_API( MenuRef )
  3062. GetControlPopupMenuHandle(ControlRef control);
  3063. #define GetControlPopupMenuRef GetControlPopupMenuHandle
  3064. /*
  3065. * GetControlPopupMenuID()
  3066. *
  3067. * Availability:
  3068. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3069. * CarbonLib: in CarbonLib 1.0 and later
  3070. * Mac OS X: in version 10.0 and later
  3071. */
  3072. EXTERN_API( short )
  3073. GetControlPopupMenuID(ControlRef control);
  3074. /* Setters */
  3075. /*
  3076. * SetControlDataHandle()
  3077. *
  3078. * Availability:
  3079. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3080. * CarbonLib: in CarbonLib 1.0 and later
  3081. * Mac OS X: in version 10.0 and later
  3082. */
  3083. EXTERN_API( void )
  3084. SetControlDataHandle(
  3085. ControlRef control,
  3086. Handle dataHandle);
  3087. /*
  3088. * SetControlBounds()
  3089. *
  3090. * Availability:
  3091. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3092. * CarbonLib: in CarbonLib 1.0 and later
  3093. * Mac OS X: in version 10.0 and later
  3094. */
  3095. EXTERN_API( void )
  3096. SetControlBounds(
  3097. ControlRef control,
  3098. const Rect * bounds);
  3099. /*
  3100. * SetControlPopupMenuHandle()
  3101. *
  3102. * Availability:
  3103. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3104. * CarbonLib: in CarbonLib 1.0 and later
  3105. * Mac OS X: in version 10.0 and later
  3106. */
  3107. EXTERN_API( void )
  3108. SetControlPopupMenuHandle(
  3109. ControlRef control,
  3110. MenuRef popupMenu);
  3111. #define SetControlPopupMenuRef SetControlPopupMenuHandle
  3112. /*
  3113. * SetControlPopupMenuID()
  3114. *
  3115. * Availability:
  3116. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  3117. * CarbonLib: in CarbonLib 1.0 and later
  3118. * Mac OS X: in version 10.0 and later
  3119. */
  3120. EXTERN_API( void )
  3121. SetControlPopupMenuID(
  3122. ControlRef control,
  3123. short menuID);
  3124. #endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  3125. #if !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS
  3126. #define GetControlListFromWindow(theWindow) ( *(ControlRef *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  3127. #define GetControlOwningWindowControlList(theWindow) ( *(ControlRef *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  3128. #endif /* !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS */
  3129. #if PRAGMA_STRUCT_ALIGN
  3130. #pragma options align=reset
  3131. #elif PRAGMA_STRUCT_PACKPUSH
  3132. #pragma pack(pop)
  3133. #elif PRAGMA_STRUCT_PACK
  3134. #pragma pack()
  3135. #endif
  3136. #ifdef PRAGMA_IMPORT_OFF
  3137. #pragma import off
  3138. #elif PRAGMA_IMPORT
  3139. #pragma import reset
  3140. #endif
  3141. #ifdef __cplusplus
  3142. }
  3143. #endif
  3144. #endif /* __CONTROLS__ */