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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       ControlDefinitions.h
  3.  
  4.      Contains:   Definitions of controls used by Control Mgr
  5.  
  6.      Version:    Technology: Mac OS 9
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1999-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CONTROLDEFINITIONS__
  18. #define __CONTROLDEFINITIONS__
  19. #ifndef __APPEARANCE__
  20. #include "Appearance.h"
  21. #endif
  22. #ifndef __CONTROLS__
  23. #include "Controls.h"
  24. #endif
  25. #ifndef __LISTS__
  26. #include "Lists.h"
  27. #endif
  28. #ifndef __MACHELP__
  29. #include "MacHelp.h"
  30. #endif
  31. #ifndef __MENUS__
  32. #include "Menus.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. /*------------------------------------------------------------------------------------------------------*/
  51. /*  o Resource Types                                                                                    */
  52. /*------------------------------------------------------------------------------------------------------*/
  53. enum {
  54.     kControlTabListResType      = FOUR_CHAR_CODE('tab#'),       /* used for tab control (Appearance 1.0 and later)*/
  55.     kControlListDescResType     = FOUR_CHAR_CODE('ldes')        /* used for list box control (Appearance 1.0 and later)*/
  56. };
  57. /*--------------------------------------------------------------------------------------*/
  58. /*  o Check Box Values                                                                  */
  59. /*--------------------------------------------------------------------------------------*/
  60. enum {
  61.     kControlCheckBoxUncheckedValue = 0,
  62.     kControlCheckBoxCheckedValue = 1,
  63.     kControlCheckBoxMixedValue  = 2
  64. };
  65. /*--------------------------------------------------------------------------------------*/
  66. /*  o Radio Button Values                                                               */
  67. /*--------------------------------------------------------------------------------------*/
  68. enum {
  69.     kControlRadioButtonUncheckedValue = 0,
  70.     kControlRadioButtonCheckedValue = 1,
  71.     kControlRadioButtonMixedValue = 2
  72. };
  73. /*--------------------------------------------------------------------------------------*/
  74. /*  o Pop-Up Menu Control Constants                                                     */
  75. /*--------------------------------------------------------------------------------------*/
  76. /* Variant codes for the System 7 pop-up menu*/
  77. enum {
  78.     popupFixedWidth             = 1 << 0,
  79.     popupVariableWidth          = 1 << 1,
  80.     popupUseAddResMenu          = 1 << 2,
  81.     popupUseWFont               = 1 << 3
  82. };
  83. /* Menu label styles for the System 7 pop-up menu*/
  84. enum {
  85.     popupTitleBold              = 1 << 8,
  86.     popupTitleItalic            = 1 << 9,
  87.     popupTitleUnderline         = 1 << 10,
  88.     popupTitleOutline           = 1 << 11,
  89.     popupTitleShadow            = 1 << 12,
  90.     popupTitleCondense          = 1 << 13,
  91.     popupTitleExtend            = 1 << 14,
  92.     popupTitleNoStyle           = 1 << 15
  93. };
  94. /* Menu label justifications for the System 7 pop-up menu*/
  95. enum {
  96.     popupTitleLeftJust          = 0x00000000,
  97.     popupTitleCenterJust        = 0x00000001,
  98.     popupTitleRightJust         = 0x000000FF
  99. };
  100. /*------------------------------------------------------------------------------------------------------*/
  101. /*  o PopUp Menu Private Data Structure                                                                 */
  102. /*------------------------------------------------------------------------------------------------------*/
  103. #if !OPAQUE_TOOLBOX_STRUCTS
  104. struct PopupPrivateData {
  105.     MenuHandle                      mHandle;
  106.     SInt16                          mID;
  107. };
  108. typedef struct PopupPrivateData         PopupPrivateData;
  109. typedef PopupPrivateData *              PopupPrivateDataPtr;
  110. typedef PopupPrivateDataPtr *           PopupPrivateDataHandle;
  111. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  112. /*------------------------------------------------------------------------------------------------------*/
  113. /*  o Control Definition ID's                                                                           */
  114. /*------------------------------------------------------------------------------------------------------*/
  115. /* Standard System 7 procIDs*/
  116. enum {
  117.     pushButProc                 = 0,
  118.     checkBoxProc                = 1,
  119.     radioButProc                = 2,
  120.     scrollBarProc               = 16,
  121.     popupMenuProc               = 1008
  122. };
  123. /*--------------------------------------------------------------------------------------*/
  124. /*  o Control Part Codes                                                                */
  125. /*--------------------------------------------------------------------------------------*/
  126. enum {
  127.     kControlLabelPart           = 1,
  128.     kControlMenuPart            = 2,
  129.     kControlTrianglePart        = 4,
  130.     kControlEditTextPart        = 5,                            /* Appearance 1.0 and later*/
  131.     kControlPicturePart         = 6,                            /* Appearance 1.0 and later*/
  132.     kControlIconPart            = 7,                            /* Appearance 1.0 and later*/
  133.     kControlClockPart           = 8,                            /* Appearance 1.0 and later*/
  134.     kControlListBoxPart         = 24,                           /* Appearance 1.0 and later*/
  135.     kControlListBoxDoubleClickPart = 25,                        /* Appearance 1.0 and later*/
  136.     kControlImageWellPart       = 26,                           /* Appearance 1.0 and later*/
  137.     kControlRadioGroupPart      = 27,                           /* Appearance 1.0.2 and later*/
  138.     kControlButtonPart          = 10,
  139.     kControlCheckBoxPart        = 11,
  140.     kControlRadioButtonPart     = 11,
  141.     kControlUpButtonPart        = 20,
  142.     kControlDownButtonPart      = 21,
  143.     kControlPageUpPart          = 22,
  144.     kControlPageDownPart        = 23,
  145.     kControlClockHourDayPart    = 9,                            /* Appearance 1.1 and later*/
  146.     kControlClockMinuteMonthPart = 10,                          /* Appearance 1.1 and later*/
  147.     kControlClockSecondYearPart = 11,                           /* Appearance 1.1 and later*/
  148.     kControlClockAMPMPart       = 12,                           /* Appearance 1.1 and later*/
  149.     kControlDataBrowserPart     = 24,                           /* CarbonLib 1.0 and later*/
  150.     kControlDataBrowserDraggedPart = 25                         /* CarbonLib 1.0 and later*/
  151. };
  152. /*------------------------------------------------------------------------------------------------------*/
  153. /*  o Control Types and ID's available only with Appearance 1.0 and later                               */
  154. /*------------------------------------------------------------------------------------------------------*/
  155. /*--------------------------------------------------------------------------------------*/
  156. /*  o BEVEL BUTTON INTERFACE (CDEF 2)                                                   */
  157. /*--------------------------------------------------------------------------------------*/
  158. /*  Bevel buttons allow you to control the content type (pict/icon/etc.), the behavior  */
  159. /* (pushbutton/toggle/sticky), and the bevel size. You also have the option of          */
  160. /*  attaching a menu to it. When a menu is present, you can specify which way the       */
  161. /*  popup arrow is facing (down or right).                                              */
  162. /*                                                                                      */
  163. /*  This is all made possible by overloading the Min, Max, and Value parameters for the */
  164. /*  control, as well as adjusting the variant. Here's the breakdown of what goes where: */
  165. /*                                                                                      */
  166. /*  Parameter                   What Goes Here                                          */
  167. /*  -------------------         ----------------------------------------------------    */
  168. /*  Min                         Hi Byte = Behavior, Lo Byte = content type.             */
  169. /*  Max                         ResID for resource-based content types.                 */
  170. /*  Value                       MenuID to attach, 0 = no menu, please.                  */
  171. /*                                                                                      */
  172. /*  The variant is broken down into two halfs. The low 2 bits control the bevel type.   */
  173. /*  Bit 2 controls the popup arrow direction (if a menu is present) and bit 3 controls  */
  174. /*  whether or not to use the control's owning window's font.                           */
  175. /*                                                                                      */
  176. /*  Constants for all you need to put this together are below. The values for behaviors */
  177. /*  are set up so that you can simply add them to the content type and pass them into   */
  178. /*  the Min parameter of NewControl.                                                    */
  179. /*                                                                                      */
  180. /*  An example call:                                                                    */
  181. /*                                                                                      */
  182. /*  control = NewControl( window, &bounds, "p", true, 0, kContentIconSuiteRes +        */
  183. /*                          kBehaviorToggles, myIconSuiteID, bevelButtonSmallBevelProc, */
  184. /*                          0L );                                                       */
  185. /*                                                                                      */
  186. /*  Attaching a menu:                                                                   */
  187. /*                                                                                      */
  188. /*  control = NewControl( window, &bounds, "p", true, kMyMenuID, kContentIconSuiteRes, */
  189. /*          myIconSuiteID, bevelButtonSmallBevelProc + kBevelButtonMenuOnRight, 0L );   */
  190. /*                                                                                      */
  191. /*  This will attach menu ID kMyMenuID to the button, with the popup arrow facing right.*/
  192. /*  This also puts the menu up to the right of the button. You can also specify that a  */
  193. /*  menu can have multiple items checked at once by adding kBehaviorMultiValueMenus     */
  194. /*  into the Min parameter. If you do use multivalue menus, the GetBevelButtonMenuValue */
  195. /*  helper function will return the last item chosen from the menu, whether or not it   */
  196. /*  was checked.                                                                        */
  197. /*                                                                                      */
  198. /*  NOTE:   Bevel buttons with menus actually have *two* values. The value of the       */
  199. /*          button (on/off), and the value of the menu. The menu value can be gotten    */
  200. /*          with the GetBevelButtonMenuValue helper function.                           */
  201. /*                                                                                      */
  202. /*  Handle-based Content                                                                */
  203. /*  --------------------                                                                */
  204. /*  You can create your control and then set the content to an existing handle to an    */
  205. /*  icon suite, etc. using the macros below. Please keep in mind that resource-based    */
  206. /*  content is owned by the control, handle-based content is owned by you. The CDEF will*/
  207. /*  not try to dispose of handle-based content. If you are changing the content type of */
  208. /*  the button on the fly, you must make sure that if you are replacing a handle-       */
  209. /*  based content with a resource-based content to properly dispose of the handle,      */
  210. /*  else a memory leak will ensue.                                                      */
  211. /*                                                                                      */
  212. /* Bevel Button Proc IDs */
  213. enum {
  214.     kControlBevelButtonSmallBevelProc = 32,
  215.     kControlBevelButtonNormalBevelProc = 33,
  216.     kControlBevelButtonLargeBevelProc = 34
  217. };
  218. /* Add these variant codes to kBevelButtonSmallBevelProc to change the type of button */
  219. enum {
  220.     kControlBevelButtonSmallBevelVariant = 0,
  221.     kControlBevelButtonNormalBevelVariant = (1 << 0),
  222.     kControlBevelButtonLargeBevelVariant = (1 << 1),
  223.     kControlBevelButtonMenuOnRightVariant = (1 << 2)
  224. };
  225. /* Bevel Thicknesses */
  226. typedef UInt16 ControlBevelThickness;
  227. enum {
  228.     kControlBevelButtonSmallBevel = 0,
  229.     kControlBevelButtonNormalBevel = 1,
  230.     kControlBevelButtonLargeBevel = 2
  231. };
  232. /* Behaviors of bevel buttons. These are set up so you can add  */
  233. /* them together with the content types.                        */
  234. enum {
  235.     kControlBehaviorPushbutton  = 0,
  236.     kControlBehaviorToggles     = 0x0100,
  237.     kControlBehaviorSticky      = 0x0200,
  238.     kControlBehaviorSingleValueMenu = 0,
  239.     kControlBehaviorMultiValueMenu = 0x4000,                    /* only makes sense when a menu is attached.*/
  240.     kControlBehaviorOffsetContents = 0x8000
  241. };
  242. /* Behaviors for 1.0.1 or later */
  243. enum {
  244.     kControlBehaviorCommandMenu = 0x2000                        /* menu holds commands, not choices. Overrides multi-value bit.*/
  245. };
  246. typedef UInt16                          ControlBevelButtonBehavior;
  247. typedef UInt16                          ControlBevelButtonMenuBehavior;
  248. /* Bevel Button Menu Placements */
  249. typedef UInt16 ControlBevelButtonMenuPlacement;
  250. enum {
  251.     kControlBevelButtonMenuOnBottom = 0,
  252.     kControlBevelButtonMenuOnRight = (1 << 2)
  253. };
  254. /* Graphic Alignments */
  255. typedef SInt16 ControlButtonGraphicAlignment;
  256. enum {
  257.     kControlBevelButtonAlignSysDirection = -1,                  /* only left or right*/
  258.     kControlBevelButtonAlignCenter = 0,
  259.     kControlBevelButtonAlignLeft = 1,
  260.     kControlBevelButtonAlignRight = 2,
  261.     kControlBevelButtonAlignTop = 3,
  262.     kControlBevelButtonAlignBottom = 4,
  263.     kControlBevelButtonAlignTopLeft = 5,
  264.     kControlBevelButtonAlignBottomLeft = 6,
  265.     kControlBevelButtonAlignTopRight = 7,
  266.     kControlBevelButtonAlignBottomRight = 8
  267. };
  268. /* Text Alignments */
  269. typedef SInt16 ControlButtonTextAlignment;
  270. enum {
  271.     kControlBevelButtonAlignTextSysDirection = teFlushDefault,
  272.     kControlBevelButtonAlignTextCenter = teCenter,
  273.     kControlBevelButtonAlignTextFlushRight = teFlushRight,
  274.     kControlBevelButtonAlignTextFlushLeft = teFlushLeft
  275. };
  276. /* Text Placements */
  277. typedef SInt16 ControlButtonTextPlacement;
  278. enum {
  279.     kControlBevelButtonPlaceSysDirection = -1,                  /* if graphic on right, then on left*/
  280.     kControlBevelButtonPlaceNormally = 0,
  281.     kControlBevelButtonPlaceToRightOfGraphic = 1,
  282.     kControlBevelButtonPlaceToLeftOfGraphic = 2,
  283.     kControlBevelButtonPlaceBelowGraphic = 3,
  284.     kControlBevelButtonPlaceAboveGraphic = 4
  285. };
  286. /* Data tags supported by the bevel button controls */
  287. enum {
  288.     kControlBevelButtonContentTag = FOUR_CHAR_CODE('cont'),     /* ButtonContentInfo*/
  289.     kControlBevelButtonTransformTag = FOUR_CHAR_CODE('tran'),   /* IconTransformType*/
  290.     kControlBevelButtonTextAlignTag = FOUR_CHAR_CODE('tali'),   /* ButtonTextAlignment*/
  291.     kControlBevelButtonTextOffsetTag = FOUR_CHAR_CODE('toff'),  /* SInt16*/
  292.     kControlBevelButtonGraphicAlignTag = FOUR_CHAR_CODE('gali'), /* ButtonGraphicAlignment*/
  293.     kControlBevelButtonGraphicOffsetTag = FOUR_CHAR_CODE('goff'), /* Point*/
  294.     kControlBevelButtonTextPlaceTag = FOUR_CHAR_CODE('tplc'),   /* ButtonTextPlacement*/
  295.     kControlBevelButtonMenuValueTag = FOUR_CHAR_CODE('mval'),   /* SInt16*/
  296.     kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd'),  /* MenuHandle*/
  297.     kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') /* Boolean: true = center, false = bottom right*/
  298. };
  299. /* These are tags in 1.0.1 or later */
  300. enum {
  301.     kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu'),    /* SInt16: menuID of last menu item selected from*/
  302.     kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly')    /* SInt32: ticks to delay before menu appears*/
  303. };
  304. /* tags available with Appearance 1.1 or later */
  305. enum {
  306.                                                                 /* Boolean: True = if an icon of the ideal size for*/
  307.                                                                 /* the button isn't available, scale a larger or*/
  308.                                                                 /* smaller icon to the ideal size. False = don't*/
  309.                                                                 /* scale; draw a smaller icon or clip a larger icon.*/
  310.                                                                 /* Default is false. Only applies to IconSuites and*/
  311.     kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal')    /* IconRefs.*/
  312. };
  313. /* Helper routines are available only thru the shared library/glue. */
  314. EXTERN_API( OSErr )
  315. GetBevelButtonMenuValue         (ControlHandle          inButton,
  316.                                  SInt16 *               outValue);
  317. EXTERN_API( OSErr )
  318. SetBevelButtonMenuValue         (ControlHandle          inButton,
  319.                                  SInt16                 inValue);
  320. EXTERN_API( OSErr )
  321. GetBevelButtonMenuHandle        (ControlHandle          inButton,
  322.                                  MenuHandle *           outHandle);
  323. EXTERN_API( OSErr )
  324. GetBevelButtonContentInfo       (ControlHandle          inButton,
  325.                                  ControlButtonContentInfoPtr  outContent);
  326. EXTERN_API( OSErr )
  327. SetBevelButtonContentInfo       (ControlHandle          inButton,
  328.                                  ControlButtonContentInfoPtr  inContent);
  329. EXTERN_API( OSErr )
  330. SetBevelButtonTransform         (ControlHandle          inButton,
  331.                                  IconTransformType      transform);
  332. EXTERN_API( OSErr )
  333. SetBevelButtonGraphicAlignment  (ControlHandle          inButton,
  334.                                  ControlButtonGraphicAlignment  inAlign,
  335.                                  SInt16                 inHOffset,
  336.                                  SInt16                 inVOffset);
  337. EXTERN_API( OSErr )
  338. SetBevelButtonTextAlignment     (ControlHandle          inButton,
  339.                                  ControlButtonTextAlignment  inAlign,
  340.                                  SInt16                 inHOffset);
  341. EXTERN_API( OSErr )
  342. SetBevelButtonTextPlacement     (ControlHandle          inButton,
  343.                                  ControlButtonTextPlacement  inWhere);
  344. /*--------------------------------------------------------------------------------------*/
  345. /*  o SLIDER (CDEF 3)                                                                   */
  346. /*--------------------------------------------------------------------------------------*/
  347. /*  There are several variants that control the behavior of the slider control. Any     */
  348. /*  combination of the following three constants can be added to the basic CDEF ID      */
  349. /*  (kSliderProc).                                                                      */
  350. /*                                                                                      */
  351. /*  Variants:                                                                           */
  352. /*                                                                                      */
  353. /*      kSliderLiveFeedback     Slider does not use "ghosted" indicator when tracking.  */
  354. /*                              ActionProc is called (set via SetControlAction) as the  */
  355. /*                              indicator is dragged. The value is updated so that the  */
  356. /*                              actionproc can adjust some other property based on the  */
  357. /*                              value each time the action proc is called. If no action */
  358. /*                              proc is installed, it reverts to the ghost indicator.   */
  359. /*                                                                                      */
  360. /*      kSliderHasTickMarks     Slider is drawn with 'tick marks'. The control          */
  361. /*                              rectangle must be large enough to accomidate the tick   */
  362. /*                              marks.                                                  */
  363. /*                                                                                      */
  364. /*      kSliderReverseDirection Slider thumb points in opposite direction than normal.  */
  365. /*                              If the slider is vertical, the thumb will point to the  */
  366. /*                              left, if the slider is horizontal, the thumb will point */
  367. /*                              upwards.                                                */
  368. /*                                                                                      */
  369. /*      kSliderNonDirectional   This option overrides the kSliderReverseDirection and   */
  370. /*                              kSliderHasTickMarks variants. It creates an indicator   */
  371. /*                              which is rectangular and doesn't point in any direction */
  372. /*                              like the normal indicator does.                         */
  373. /* Slider proc ID and variants */
  374. enum {
  375.     kControlSliderProc          = 48,
  376.     kControlSliderLiveFeedback  = (1 << 0),
  377.     kControlSliderHasTickMarks  = (1 << 1),
  378.     kControlSliderReverseDirection = (1 << 2),
  379.     kControlSliderNonDirectional = (1 << 3)
  380. };
  381. /*--------------------------------------------------------------------------------------*/
  382. /*  o DISCLOSURE TRIANGLE (CDEF 4)                                                      */
  383. /*--------------------------------------------------------------------------------------*/
  384. /*  This control can be used as either left or right facing. It can also handle its own */
  385. /*  tracking if you wish. This means that when the 'autotoggle' variant is used, if the */
  386. /*  user clicks the control, it's state will change automatically from open to closed   */
  387. /*  and vice-versa depending on its initial state. After a successful call to Track-    */
  388. /*  Control, you can just check the current value to see what state it was switched to. */
  389. /* Triangle proc IDs */
  390. enum {
  391.     kControlTriangleProc        = 64,
  392.     kControlTriangleLeftFacingProc = 65,
  393.     kControlTriangleAutoToggleProc = 66,
  394.     kControlTriangleLeftFacingAutoToggleProc = 67
  395. };
  396. /* Tagged data supported by disclosure triangles */
  397. enum {
  398.     kControlTriangleLastValueTag = FOUR_CHAR_CODE('last')       /* SInt16*/
  399. };
  400. /* Helper routines are available only thru the shared library/glue. */
  401. EXTERN_API( OSErr )
  402. SetDisclosureTriangleLastValue  (ControlHandle          inTabControl,
  403.                                  SInt16                 inValue);
  404. /*--------------------------------------------------------------------------------------*/
  405. /*  o PROGRESS INDICATOR (CDEF 5)                                                       */
  406. /*--------------------------------------------------------------------------------------*/
  407. /*  This CDEF implements both determinate and indeterminate progress bars. To switch,   */
  408. /*  just use SetControlData to set the indeterminate flag to make it indeterminate call */
  409. /*  IdleControls to step thru the animation. IdleControls should be called at least     */
  410. /*  once during your event loop.                                                        */
  411. /*                                                                                      */
  412. /* Progress Bar proc IDs */
  413. enum {
  414.     kControlProgressBarProc     = 80
  415. };
  416. /* Tagged data supported by progress bars */
  417. enum {
  418.     kControlProgressBarIndeterminateTag = FOUR_CHAR_CODE('inde') /* Boolean*/
  419. };
  420. /*--------------------------------------------------------------------------------------*/
  421. /*  o LITTLE ARROWS (CDEF 6)                                                            */
  422. /*--------------------------------------------------------------------------------------*/
  423. /*  This control implements the little up and down arrows you'd see in the Memory       */
  424. /*  control panel for adjusting the cache size.                                         */
  425. /* Little Arrows proc IDs */
  426. enum {
  427.     kControlLittleArrowsProc    = 96
  428. };
  429. /*--------------------------------------------------------------------------------------*/
  430. /*  o CHASING ARROWS (CDEF 7)                                                           */
  431. /*--------------------------------------------------------------------------------------*/
  432. /*  To animate this control, make sure to call IdleControls repeatedly.                 */
  433. /*                                                                                      */
  434. /* Chasing Arrows proc IDs */
  435. enum {
  436.     kControlChasingArrowsProc   = 112
  437. };
  438. /*--------------------------------------------------------------------------------------*/
  439. /*  o TABS (CDEF 8)                                                                     */
  440. /*--------------------------------------------------------------------------------------*/
  441. /*  Tabs use an auxiliary resource (tab#) to hold tab information such as the tab name  */
  442. /*  and an icon suite ID for each tab.                                                  */
  443. /*                                                                                      */
  444. /*  The ID of the tab# resource that you wish to associate with a tab control should    */
  445. /*  be passed in as the Value parameter of the control. If you are using GetNewControl, */
  446. /*  then the Value slot in the CNTL resource should have the ID of the 'tab#' resource  */
  447. /*  on creation.                                                                        */
  448. /*                                                                                      */
  449. /*  Passing zero in for the tab# resource tells the control not to read in a tab# res.  */
  450. /*  You can then use SetControlMaximum to add tabs, followed by a call to SetControlData*/
  451. /*  with the kControlTabInfoTag, passing in a pointer to a ControlTabInfoRec. This sets */
  452. /*  the name and optionally an icon for a tab.                                          */
  453. /* Tabs proc IDs */
  454. enum {
  455.     kControlTabLargeProc        = 128,                          /* Large tab size, north facing   */
  456.     kControlTabSmallProc        = 129,                          /* Small tab size, north facing   */
  457.     kControlTabLargeNorthProc   = 128,                          /* Large tab size, north facing   */
  458.     kControlTabSmallNorthProc   = 129,                          /* Small tab size, north facing   */
  459.     kControlTabLargeSouthProc   = 130,                          /* Large tab size, south facing   */
  460.     kControlTabSmallSouthProc   = 131,                          /* Small tab size, south facing   */
  461.     kControlTabLargeEastProc    = 132,                          /* Large tab size, east facing    */
  462.     kControlTabSmallEastProc    = 133,                          /* Small tab size, east facing    */
  463.     kControlTabLargeWestProc    = 134,                          /* Large tab size, west facing    */
  464.     kControlTabSmallWestProc    = 135                           /* Small tab size, west facing    */
  465. };
  466. /* Tagged data supported by tabs */
  467. enum {
  468.     kControlTabContentRectTag   = FOUR_CHAR_CODE('rect'),       /* Rect*/
  469.     kControlTabEnabledFlagTag   = FOUR_CHAR_CODE('enab'),       /* Boolean*/
  470.     kControlTabFontStyleTag     = kControlFontStyleTag          /* ControlFontStyleRec*/
  471. };
  472. /* New tags in 1.0.1 or later */
  473. enum {
  474.     kControlTabInfoTag          = FOUR_CHAR_CODE('tabi')        /* ControlTabInfoRec*/
  475. };
  476. enum {
  477.     kControlTabInfoVersionZero  = 0
  478. };
  479. struct ControlTabInfoRec {
  480.     SInt16                          version;                    /* version of this structure.*/
  481.     SInt16                          iconSuiteID;                /* icon suite to use. Zero indicates no icon*/
  482.     Str255                          name;                       /* name to be displayed on the tab*/
  483. };
  484. typedef struct ControlTabInfoRec        ControlTabInfoRec;
  485. /* Helper routines are available only thru the shared library/glue. */
  486. EXTERN_API( OSErr )
  487. GetTabContentRect               (ControlHandle          inTabControl,
  488.                                  Rect *                 outContentRect);
  489. EXTERN_API( OSErr )
  490. SetTabEnabled                   (ControlHandle          inTabControl,
  491.                                  SInt16                 inTabToHilite,
  492.                                  Boolean                inEnabled);
  493. /*--------------------------------------------------------------------------------------*/
  494. /*  o VISUAL SEPARATOR (CDEF 9)                                                         */
  495. /*--------------------------------------------------------------------------------------*/
  496. /*  Separator lines determine their orientation (horizontal or vertical) automatically  */
  497. /*  based on the relative height and width of their contrlRect.                         */
  498. /* Visual separator proc IDs */
  499. enum {
  500.     kControlSeparatorLineProc   = 144
  501. };
  502. /*--------------------------------------------------------------------------------------*/
  503. /*  o GROUP BOX (CDEF 10)                                                               */
  504. /*--------------------------------------------------------------------------------------*/
  505. /*  The group box CDEF can be use in several ways. It can have no title, a text title,  */
  506. /*  a check box as the title, or a popup button as a title. There are two versions of   */
  507. /*  group boxes, primary and secondary, which look slightly different.                  */
  508. /* Group Box proc IDs */
  509. enum {
  510.     kControlGroupBoxTextTitleProc = 160,
  511.     kControlGroupBoxCheckBoxProc = 161,
  512.     kControlGroupBoxPopupButtonProc = 162,
  513.     kControlGroupBoxSecondaryTextTitleProc = 164,
  514.     kControlGroupBoxSecondaryCheckBoxProc = 165,
  515.     kControlGroupBoxSecondaryPopupButtonProc = 166
  516. };
  517. /* Tagged data supported by group box */
  518. enum {
  519.     kControlGroupBoxMenuHandleTag = FOUR_CHAR_CODE('mhan'),     /* MenuHandle (popup title only)*/
  520.     kControlGroupBoxFontStyleTag = kControlFontStyleTag         /* ControlFontStyleRec*/
  521. };
  522. /* tags available with Appearance 1.1 or later */
  523. enum {
  524.     kControlGroupBoxTitleRectTag = FOUR_CHAR_CODE('trec')       /* Rect. Rectangle that the title text/control is drawn in. (get only)*/
  525. };
  526. /*--------------------------------------------------------------------------------------*/
  527. /*  o IMAGE WELL (CDEF 11)                                                              */
  528. /*--------------------------------------------------------------------------------------*/
  529. /*  Image Wells allow you to control the content type (pict/icon/etc.) shown in the     */
  530. /*  well.                                                                               */
  531. /*                                                                                      */
  532. /*  This is made possible by overloading the Min and Value parameters for the control.  */
  533. /*                                                                                      */
  534. /*  Parameter                   What Goes Here                                          */
  535. /*  -------------------         --------------------------------------------------      */
  536. /*  Min                         content type (see constants for bevel buttons)          */
  537. /*  Value                       Resource ID of content type, if resource-based.         */
  538. /*                                                                                      */
  539. /*                                                                                      */
  540. /*  Handle-based Content                                                                */
  541. /*  --------------------                                                                */
  542. /*  You can create your control and then set the content to an existing handle to an    */
  543. /*  icon suite, etc. using the macros below. Please keep in mind that resource-based    */
  544. /*  content is owned by the control, handle-based content is owned by you. The CDEF will*/
  545. /*  not try to dispose of handle-based content. If you are changing the content type of */
  546. /*  the button on the fly, you must make sure that if you are replacing a handle-       */
  547. /*  based content with a resource-based content to properly dispose of the handle,      */
  548. /*  else a memory leak will ensue.                                                      */
  549. /*                                                                                      */
  550. /* Image Well proc IDs */
  551. enum {
  552.     kControlImageWellProc       = 176
  553. };
  554. /* Tagged data supported by image wells */
  555. enum {
  556.     kControlImageWellContentTag = FOUR_CHAR_CODE('cont'),       /* ButtonContentInfo*/
  557.     kControlImageWellTransformTag = FOUR_CHAR_CODE('tran')      /* IconTransformType*/
  558. };
  559. /* Helper routines are available only thru the shared library/glue. */
  560. EXTERN_API( OSErr )
  561. GetImageWellContentInfo         (ControlHandle          inButton,
  562.                                  ControlButtonContentInfoPtr  outContent);
  563. EXTERN_API( OSErr )
  564. SetImageWellContentInfo         (ControlHandle          inButton,
  565.                                  ControlButtonContentInfoPtr  inContent);
  566. EXTERN_API( OSErr )
  567. SetImageWellTransform           (ControlHandle          inButton,
  568.                                  IconTransformType      inTransform);
  569. /*--------------------------------------------------------------------------------------*/
  570. /*  o POPUP ARROW (CDEF 12)                                                             */
  571. /*--------------------------------------------------------------------------------------*/
  572. /*  The popup arrow CDEF is used to draw the small arrow normally associated with a     */
  573. /*  popup control. The arrow can point in four directions, and a small or large version */
  574. /*  can be used. This control is provided to allow clients to draw the arrow in a       */
  575. /*  normalized fashion which will take advantage of themes automatically.               */
  576. /*                                                                                      */
  577. /* Popup Arrow proc IDs */
  578. enum {
  579.     kControlPopupArrowEastProc  = 192,
  580.     kControlPopupArrowWestProc  = 193,
  581.     kControlPopupArrowNorthProc = 194,
  582.     kControlPopupArrowSouthProc = 195,
  583.     kControlPopupArrowSmallEastProc = 196,
  584.     kControlPopupArrowSmallWestProc = 197,
  585.     kControlPopupArrowSmallNorthProc = 198,
  586.     kControlPopupArrowSmallSouthProc = 199
  587. };
  588. /* Popup Arrow Orientations */
  589. enum {
  590.     kControlPopupArrowOrientationEast = 0,
  591.     kControlPopupArrowOrientationWest = 1,
  592.     kControlPopupArrowOrientationNorth = 2,
  593.     kControlPopupArrowOrientationSouth = 3
  594. };
  595. typedef UInt16                          ControlPopupArrowOrientation;
  596. /*--------------------------------------------------------------------------------------*/
  597. /*  o PLACARD (CDEF 14)                                                                 */
  598. /*--------------------------------------------------------------------------------------*/
  599. /* Placard proc IDs */
  600. enum {
  601.     kControlPlacardProc         = 224
  602. };
  603. /*--------------------------------------------------------------------------------------*/
  604. /*  o CLOCK (CDEF 15)                                                                   */
  605. /*--------------------------------------------------------------------------------------*/
  606. /*  NOTE:   You can specify more options in the Value paramter when creating the clock. */
  607. /*          See below.                                                                  */
  608. /*                                                                                      */
  609. /*  NOTE:   Under Appearance 1.1, the clock control knows and returns more part codes.  */
  610. /*          The new clock-specific part codes are defined with the other control parts. */
  611. /*          Besides these clock-specific parts, we also return kControlUpButtonPart     */
  612. /*          and kControlDownButtonPart when they hit the up and down arrows.            */
  613. /*          The new part codes give you more flexibility for focusing and hit testing.  */
  614. /*                                                                                      */
  615. /*          The original kControlClockPart is still valid. When hit testing, it means   */
  616. /*          that some non-editable area of the clock's whitespace has been clicked.     */
  617. /*          When focusing a currently unfocused clock, it changes the focus to the      */
  618. /*          first part; it is the same as passing kControlFocusNextPart. When           */
  619. /*          re-focusing a focused clock, it will not change the focus at all.           */
  620. /* Clock proc IDs */
  621. enum {
  622.     kControlClockTimeProc       = 240,
  623.     kControlClockTimeSecondsProc = 241,
  624.     kControlClockDateProc       = 242,
  625.     kControlClockMonthYearProc  = 243
  626. };
  627. /* Clock Types */
  628. typedef UInt16 ControlClockType;
  629. enum {
  630.     kControlClockTypeHourMinute = 0,
  631.     kControlClockTypeHourMinuteSecond = 1,
  632.     kControlClockTypeMonthDay   = 2,
  633.     kControlClockTypeMonthDayYear = 3
  634. };
  635. /* Clock Flags */
  636. /*  These flags can be passed into 'value' field on creation of the control.            */
  637. /*  Value is set to 0 after control is created.                                         */
  638. typedef UInt32 ControlClockFlags;
  639. enum {
  640.     kControlClockFlagStandard   = 0,                            /* editable, non-live*/
  641.     kControlClockNoFlags        = 0,
  642.     kControlClockFlagDisplayOnly = 1,                           /* add this to become non-editable*/
  643.     kControlClockIsDisplayOnly  = 1,
  644.     kControlClockFlagLive       = 2,                            /* automatically shows current time on idle. only valid with display only.*/
  645.     kControlClockIsLive         = 2
  646. };
  647. /* Tagged data supported by clocks */
  648. enum {
  649.     kControlClockLongDateTag    = FOUR_CHAR_CODE('date'),       /* LongDateRec*/
  650.     kControlClockFontStyleTag   = kControlFontStyleTag          /* ControlFontStyleRec*/
  651. };
  652. /*--------------------------------------------------------------------------------------*/
  653. /*  o USER PANE (CDEF 16)                                                               */
  654. /*--------------------------------------------------------------------------------------*/
  655. /* User Pane proc IDs */
  656. enum {
  657.     kControlUserPaneProc        = 256
  658. };
  659. /* Tagged data supported by user panes */
  660. /* Currently, they are all proc ptrs for doing things like drawing and hit testing, etc. */
  661. enum {
  662.     kControlUserItemDrawProcTag = FOUR_CHAR_CODE('uidp'),       /* UserItemUPP*/
  663.     kControlUserPaneDrawProcTag = FOUR_CHAR_CODE('draw'),       /* ControlUserPaneDrawingUPP*/
  664.     kControlUserPaneHitTestProcTag = FOUR_CHAR_CODE('hitt'),    /* ControlUserPaneHitTestUPP*/
  665.     kControlUserPaneTrackingProcTag = FOUR_CHAR_CODE('trak'),   /* ControlUserPaneTrackingUPP*/
  666.     kControlUserPaneIdleProcTag = FOUR_CHAR_CODE('idle'),       /* ControlUserPaneIdleUPP*/
  667.     kControlUserPaneKeyDownProcTag = FOUR_CHAR_CODE('keyd'),    /* ControlUserPaneKeyDownUPP*/
  668.     kControlUserPaneActivateProcTag = FOUR_CHAR_CODE('acti'),   /* ControlUserPaneActivateUPP*/
  669.     kControlUserPaneFocusProcTag = FOUR_CHAR_CODE('foci'),      /* ControlUserPaneFocusUPP*/
  670.     kControlUserPaneBackgroundProcTag = FOUR_CHAR_CODE('back')  /* ControlUserPaneBackgroundUPP*/
  671. };
  672. typedef CALLBACK_API( void , ControlUserPaneDrawProcPtr )(ControlHandle control, SInt16 part);
  673. typedef CALLBACK_API( ControlPartCode , ControlUserPaneHitTestProcPtr )(ControlHandle control, Point where);
  674. typedef CALLBACK_API( ControlPartCode , ControlUserPaneTrackingProcPtr )(ControlHandle control, Point startPt, ControlActionUPP actionProc);
  675. typedef CALLBACK_API( void , ControlUserPaneIdleProcPtr )(ControlHandle control);
  676. typedef CALLBACK_API( ControlPartCode , ControlUserPaneKeyDownProcPtr )(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers);
  677. typedef CALLBACK_API( void , ControlUserPaneActivateProcPtr )(ControlHandle control, Boolean activating);
  678. typedef CALLBACK_API( ControlPartCode , ControlUserPaneFocusProcPtr )(ControlHandle control, ControlFocusPart action);
  679. typedef CALLBACK_API( void , ControlUserPaneBackgroundProcPtr )(ControlHandle control, ControlBackgroundPtr info);
  680. typedef STACK_UPP_TYPE(ControlUserPaneDrawProcPtr)              ControlUserPaneDrawUPP;
  681. typedef STACK_UPP_TYPE(ControlUserPaneHitTestProcPtr)           ControlUserPaneHitTestUPP;
  682. typedef STACK_UPP_TYPE(ControlUserPaneTrackingProcPtr)          ControlUserPaneTrackingUPP;
  683. typedef STACK_UPP_TYPE(ControlUserPaneIdleProcPtr)              ControlUserPaneIdleUPP;
  684. typedef STACK_UPP_TYPE(ControlUserPaneKeyDownProcPtr)           ControlUserPaneKeyDownUPP;
  685. typedef STACK_UPP_TYPE(ControlUserPaneActivateProcPtr)          ControlUserPaneActivateUPP;
  686. typedef STACK_UPP_TYPE(ControlUserPaneFocusProcPtr)             ControlUserPaneFocusUPP;
  687. typedef STACK_UPP_TYPE(ControlUserPaneBackgroundProcPtr)        ControlUserPaneBackgroundUPP;
  688. #if OPAQUE_UPP_TYPES
  689.     EXTERN_API(ControlUserPaneDrawUPP)
  690.     NewControlUserPaneDrawUPP      (ControlUserPaneDrawProcPtr userRoutine);
  691.     EXTERN_API(ControlUserPaneHitTestUPP)
  692.     NewControlUserPaneHitTestUPP    (ControlUserPaneHitTestProcPtr userRoutine);
  693.     EXTERN_API(ControlUserPaneTrackingUPP)
  694.     NewControlUserPaneTrackingUPP    (ControlUserPaneTrackingProcPtr userRoutine);
  695.     EXTERN_API(ControlUserPaneIdleUPP)
  696.     NewControlUserPaneIdleUPP      (ControlUserPaneIdleProcPtr userRoutine);
  697.     EXTERN_API(ControlUserPaneKeyDownUPP)
  698.     NewControlUserPaneKeyDownUPP    (ControlUserPaneKeyDownProcPtr userRoutine);
  699.     EXTERN_API(ControlUserPaneActivateUPP)
  700.     NewControlUserPaneActivateUPP    (ControlUserPaneActivateProcPtr userRoutine);
  701.     EXTERN_API(ControlUserPaneFocusUPP)
  702.     NewControlUserPaneFocusUPP     (ControlUserPaneFocusProcPtr userRoutine);
  703.     EXTERN_API(ControlUserPaneBackgroundUPP)
  704.     NewControlUserPaneBackgroundUPP    (ControlUserPaneBackgroundProcPtr userRoutine);
  705.     EXTERN_API(void)
  706.     DisposeControlUserPaneDrawUPP    (ControlUserPaneDrawUPP userUPP);
  707.     EXTERN_API(void)
  708.     DisposeControlUserPaneHitTestUPP    (ControlUserPaneHitTestUPP userUPP);
  709.     EXTERN_API(void)
  710.     DisposeControlUserPaneTrackingUPP    (ControlUserPaneTrackingUPP userUPP);
  711.     EXTERN_API(void)
  712.     DisposeControlUserPaneIdleUPP    (ControlUserPaneIdleUPP userUPP);
  713.     EXTERN_API(void)
  714.     DisposeControlUserPaneKeyDownUPP    (ControlUserPaneKeyDownUPP userUPP);
  715.     EXTERN_API(void)
  716.     DisposeControlUserPaneActivateUPP    (ControlUserPaneActivateUPP userUPP);
  717.     EXTERN_API(void)
  718.     DisposeControlUserPaneFocusUPP    (ControlUserPaneFocusUPP userUPP);
  719.     EXTERN_API(void)
  720.     DisposeControlUserPaneBackgroundUPP    (ControlUserPaneBackgroundUPP userUPP);
  721.     EXTERN_API(void)
  722.     InvokeControlUserPaneDrawUPP    (ControlHandle          control,
  723.                                     SInt16                  part,
  724.                                     ControlUserPaneDrawUPP  userUPP);
  725.     EXTERN_API(ControlPartCode)
  726.     InvokeControlUserPaneHitTestUPP    (ControlHandle       control,
  727.                                     Point                   where,
  728.                                     ControlUserPaneHitTestUPP userUPP);
  729.     EXTERN_API(ControlPartCode)
  730.     InvokeControlUserPaneTrackingUPP    (ControlHandle      control,
  731.                                     Point                   startPt,
  732.                                     ControlActionUPP        actionProc,
  733.                                     ControlUserPaneTrackingUPP userUPP);
  734.     EXTERN_API(void)
  735.     InvokeControlUserPaneIdleUPP    (ControlHandle          control,
  736.                                     ControlUserPaneIdleUPP  userUPP);
  737.     EXTERN_API(ControlPartCode)
  738.     InvokeControlUserPaneKeyDownUPP    (ControlHandle       control,
  739.                                     SInt16                  keyCode,
  740.                                     SInt16                  charCode,
  741.                                     SInt16                  modifiers,
  742.                                     ControlUserPaneKeyDownUPP userUPP);
  743.     EXTERN_API(void)
  744.     InvokeControlUserPaneActivateUPP    (ControlHandle      control,
  745.                                     Boolean                 activating,
  746.                                     ControlUserPaneActivateUPP userUPP);
  747.     EXTERN_API(ControlPartCode)
  748.     InvokeControlUserPaneFocusUPP    (ControlHandle         control,
  749.                                     ControlFocusPart        action,
  750.                                     ControlUserPaneFocusUPP userUPP);
  751.     EXTERN_API(void)
  752.     InvokeControlUserPaneBackgroundUPP    (ControlHandle    control,
  753.                                     ControlBackgroundPtr    info,
  754.                                     ControlUserPaneBackgroundUPP userUPP);
  755. #else
  756.     enum { uppControlUserPaneDrawProcInfo = 0x000002C0 };           /* pascal no_return_value Func(4_bytes, 2_bytes) */
  757.     enum { uppControlUserPaneHitTestProcInfo = 0x000003E0 };        /* pascal 2_bytes Func(4_bytes, 4_bytes) */
  758.     enum { uppControlUserPaneTrackingProcInfo = 0x00000FE0 };       /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  759.     enum { uppControlUserPaneIdleProcInfo = 0x000000C0 };           /* pascal no_return_value Func(4_bytes) */
  760.     enum { uppControlUserPaneKeyDownProcInfo = 0x00002AE0 };        /* pascal 2_bytes Func(4_bytes, 2_bytes, 2_bytes, 2_bytes) */
  761.     enum { uppControlUserPaneActivateProcInfo = 0x000001C0 };       /* pascal no_return_value Func(4_bytes, 1_byte) */
  762.     enum { uppControlUserPaneFocusProcInfo = 0x000002E0 };          /* pascal 2_bytes Func(4_bytes, 2_bytes) */
  763.     enum { uppControlUserPaneBackgroundProcInfo = 0x000003C0 };     /* pascal no_return_value Func(4_bytes, 4_bytes) */
  764.     #define NewControlUserPaneDrawUPP(userRoutine)                  (ControlUserPaneDrawUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneDrawProcInfo, GetCurrentArchitecture())
  765.     #define NewControlUserPaneHitTestUPP(userRoutine)               (ControlUserPaneHitTestUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneHitTestProcInfo, GetCurrentArchitecture())
  766.     #define NewControlUserPaneTrackingUPP(userRoutine)              (ControlUserPaneTrackingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneTrackingProcInfo, GetCurrentArchitecture())
  767.     #define NewControlUserPaneIdleUPP(userRoutine)                  (ControlUserPaneIdleUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneIdleProcInfo, GetCurrentArchitecture())
  768.     #define NewControlUserPaneKeyDownUPP(userRoutine)               (ControlUserPaneKeyDownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneKeyDownProcInfo, GetCurrentArchitecture())
  769.     #define NewControlUserPaneActivateUPP(userRoutine)              (ControlUserPaneActivateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneActivateProcInfo, GetCurrentArchitecture())
  770.     #define NewControlUserPaneFocusUPP(userRoutine)                 (ControlUserPaneFocusUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneFocusProcInfo, GetCurrentArchitecture())
  771.     #define NewControlUserPaneBackgroundUPP(userRoutine)            (ControlUserPaneBackgroundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneBackgroundProcInfo, GetCurrentArchitecture())
  772.     #define DisposeControlUserPaneDrawUPP(userUPP)                  DisposeRoutineDescriptor(userUPP)
  773.     #define DisposeControlUserPaneHitTestUPP(userUPP)               DisposeRoutineDescriptor(userUPP)
  774.     #define DisposeControlUserPaneTrackingUPP(userUPP)              DisposeRoutineDescriptor(userUPP)
  775.     #define DisposeControlUserPaneIdleUPP(userUPP)                  DisposeRoutineDescriptor(userUPP)
  776.     #define DisposeControlUserPaneKeyDownUPP(userUPP)               DisposeRoutineDescriptor(userUPP)
  777.     #define DisposeControlUserPaneActivateUPP(userUPP)              DisposeRoutineDescriptor(userUPP)
  778.     #define DisposeControlUserPaneFocusUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  779.     #define DisposeControlUserPaneBackgroundUPP(userUPP)            DisposeRoutineDescriptor(userUPP)
  780.     #define InvokeControlUserPaneDrawUPP(control, part, userUPP)    CALL_TWO_PARAMETER_UPP((userUPP), uppControlUserPaneDrawProcInfo, (control), (part))
  781.     #define InvokeControlUserPaneHitTestUPP(control, where, userUPP)  (ControlPartCode)CALL_TWO_PARAMETER_UPP((userUPP), uppControlUserPaneHitTestProcInfo, (control), (where))
  782.     #define InvokeControlUserPaneTrackingUPP(control, startPt, actionProc, userUPP)  (ControlPartCode)CALL_THREE_PARAMETER_UPP((userUPP), uppControlUserPaneTrackingProcInfo, (control), (startPt), (actionProc))
  783.     #define InvokeControlUserPaneIdleUPP(control, userUPP)          CALL_ONE_PARAMETER_UPP((userUPP), uppControlUserPaneIdleProcInfo, (control))
  784.     #define InvokeControlUserPaneKeyDownUPP(control, keyCode, charCode, modifiers, userUPP)  (ControlPartCode)CALL_FOUR_PARAMETER_UPP((userUPP), uppControlUserPaneKeyDownProcInfo, (control), (keyCode), (charCode), (modifiers))
  785.     #define InvokeControlUserPaneActivateUPP(control, activating, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppControlUserPaneActivateProcInfo, (control), (activating))
  786.     #define InvokeControlUserPaneFocusUPP(control, action, userUPP)  (ControlPartCode)CALL_TWO_PARAMETER_UPP((userUPP), uppControlUserPaneFocusProcInfo, (control), (action))
  787.     #define InvokeControlUserPaneBackgroundUPP(control, info, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppControlUserPaneBackgroundProcInfo, (control), (info))
  788. #endif
  789. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  790. #define NewControlUserPaneDrawProc(userRoutine)                 NewControlUserPaneDrawUPP(userRoutine)
  791. #define NewControlUserPaneHitTestProc(userRoutine)              NewControlUserPaneHitTestUPP(userRoutine)
  792. #define NewControlUserPaneTrackingProc(userRoutine)             NewControlUserPaneTrackingUPP(userRoutine)
  793. #define NewControlUserPaneIdleProc(userRoutine)                 NewControlUserPaneIdleUPP(userRoutine)
  794. #define NewControlUserPaneKeyDownProc(userRoutine)              NewControlUserPaneKeyDownUPP(userRoutine)
  795. #define NewControlUserPaneActivateProc(userRoutine)             NewControlUserPaneActivateUPP(userRoutine)
  796. #define NewControlUserPaneFocusProc(userRoutine)                NewControlUserPaneFocusUPP(userRoutine)
  797. #define NewControlUserPaneBackgroundProc(userRoutine)           NewControlUserPaneBackgroundUPP(userRoutine)
  798. #define CallControlUserPaneDrawProc(userRoutine, control, part) InvokeControlUserPaneDrawUPP(control, part, userRoutine)
  799. #define CallControlUserPaneHitTestProc(userRoutine, control, where) InvokeControlUserPaneHitTestUPP(control, where, userRoutine)
  800. #define CallControlUserPaneTrackingProc(userRoutine, control, startPt, actionProc) InvokeControlUserPaneTrackingUPP(control, startPt, actionProc, userRoutine)
  801. #define CallControlUserPaneIdleProc(userRoutine, control)       InvokeControlUserPaneIdleUPP(control, userRoutine)
  802. #define CallControlUserPaneKeyDownProc(userRoutine, control, keyCode, charCode, modifiers) InvokeControlUserPaneKeyDownUPP(control, keyCode, charCode, modifiers, userRoutine)
  803. #define CallControlUserPaneActivateProc(userRoutine, control, activating) InvokeControlUserPaneActivateUPP(control, activating, userRoutine)
  804. #define CallControlUserPaneFocusProc(userRoutine, control, action) InvokeControlUserPaneFocusUPP(control, action, userRoutine)
  805. #define CallControlUserPaneBackgroundProc(userRoutine, control, info) InvokeControlUserPaneBackgroundUPP(control, info, userRoutine)
  806. /*
  807.   ------------------------------------------------------------------------------------------
  808.     o EDIT TEXT (CDEF 17)
  809.   ------------------------------------------------------------------------------------------
  810. */
  811. /* Edit Text proc IDs */
  812. enum {
  813.     kControlEditTextProc        = 272,
  814.     kControlEditTextPasswordProc = 274
  815. };
  816. /* proc IDs available with Appearance 1.1 or later */
  817. enum {
  818.     kControlEditTextInlineInputProc = 276                       /* Can't combine with the other variants*/
  819. };
  820. /* Tagged data supported by edit text */
  821. enum {
  822.     kControlEditTextStyleTag    = kControlFontStyleTag,         /* ControlFontStyleRec*/
  823.     kControlEditTextTextTag     = FOUR_CHAR_CODE('text'),       /* Buffer of chars - you supply the buffer*/
  824.     kControlEditTextTEHandleTag = FOUR_CHAR_CODE('than'),       /* The TEHandle of the text edit record*/
  825.     kControlEditTextKeyFilterTag = kControlKeyFilterTag,
  826.     kControlEditTextSelectionTag = FOUR_CHAR_CODE('sele'),      /* EditTextSelectionRec*/
  827.     kControlEditTextPasswordTag = FOUR_CHAR_CODE('pass')        /* The clear text password text*/
  828. };
  829. /* tags available with Appearance 1.1 or later */
  830. enum {
  831.     kControlEditTextKeyScriptBehaviorTag = FOUR_CHAR_CODE('kscr'), /* ControlKeyScriptBehavior. Defaults to "PrefersRoman" for password fields,*/
  832.                                                                 /*       or "AllowAnyScript" for non-password fields.*/
  833.     kControlEditTextLockedTag   = FOUR_CHAR_CODE('lock'),       /* Boolean. Locking disables editability.*/
  834.     kControlEditTextFixedTextTag = FOUR_CHAR_CODE('ftxt'),      /* Like the normal text tag, but fixes inline input first*/
  835.     kControlEditTextValidationProcTag = FOUR_CHAR_CODE('vali'), /* ControlEditTextValidationUPP. Called when a key filter can't be: after cut, paste, etc.*/
  836.     kControlEditTextInlinePreUpdateProcTag = FOUR_CHAR_CODE('prup'), /* TSMTEPreUpdateUPP and TSMTEPostUpdateUpp. For use with inline input variant...*/
  837.     kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') /* ...The refCon parameter will contain the ControlHandle.*/
  838. };
  839. /* Structure for getting the edit text selection */
  840. struct ControlEditTextSelectionRec {
  841.     SInt16                          selStart;
  842.     SInt16                          selEnd;
  843. };
  844. typedef struct ControlEditTextSelectionRec ControlEditTextSelectionRec;
  845. typedef ControlEditTextSelectionRec *   ControlEditTextSelectionPtr;
  846. typedef CALLBACK_API( void , ControlEditTextValidationProcPtr )(ControlHandle control);
  847. typedef STACK_UPP_TYPE(ControlEditTextValidationProcPtr)        ControlEditTextValidationUPP;
  848. #if OPAQUE_UPP_TYPES
  849.     EXTERN_API(ControlEditTextValidationUPP)
  850.     NewControlEditTextValidationUPP    (ControlEditTextValidationProcPtr userRoutine);
  851.     EXTERN_API(void)
  852.     DisposeControlEditTextValidationUPP    (ControlEditTextValidationUPP userUPP);
  853.     EXTERN_API(void)
  854.     InvokeControlEditTextValidationUPP    (ControlHandle    control,
  855.                                     ControlEditTextValidationUPP userUPP);
  856. #else
  857.     enum { uppControlEditTextValidationProcInfo = 0x000000C0 };     /* pascal no_return_value Func(4_bytes) */
  858.     #define NewControlEditTextValidationUPP(userRoutine)            (ControlEditTextValidationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlEditTextValidationProcInfo, GetCurrentArchitecture())
  859.     #define DisposeControlEditTextValidationUPP(userUPP)            DisposeRoutineDescriptor(userUPP)
  860.     #define InvokeControlEditTextValidationUPP(control, userUPP)    CALL_ONE_PARAMETER_UPP((userUPP), uppControlEditTextValidationProcInfo, (control))
  861. #endif
  862. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  863. #define NewControlEditTextValidationProc(userRoutine)           NewControlEditTextValidationUPP(userRoutine)
  864. #define CallControlEditTextValidationProc(userRoutine, control) InvokeControlEditTextValidationUPP(control, userRoutine)
  865. /*--------------------------------------------------------------------------------------*/
  866. /*  o STATIC TEXT (CDEF 18)                                                             */
  867. /*--------------------------------------------------------------------------------------*/
  868. /* Static Text proc IDs */
  869. enum {
  870.     kControlStaticTextProc      = 288
  871. };
  872. /* Tagged data supported by static text */
  873. enum {
  874.     kControlStaticTextStyleTag  = kControlFontStyleTag,         /* ControlFontStyleRec*/
  875.     kControlStaticTextTextTag   = FOUR_CHAR_CODE('text'),       /* Copy of text*/
  876.     kControlStaticTextTextHeightTag = FOUR_CHAR_CODE('thei')    /* SInt16*/
  877. };
  878. /* Tags available with appearance 1.1 or later */
  879. enum {
  880.     kControlStaticTextTruncTag  = FOUR_CHAR_CODE('trun')        /* TruncCode (-1 means no truncation)*/
  881. };
  882. /*--------------------------------------------------------------------------------------*/
  883. /*  o PICTURE CONTROL (CDEF 19)                                                         */
  884. /*--------------------------------------------------------------------------------------*/
  885. /*  Value parameter should contain the ID of the picture you wish to display when       */
  886. /*  creating controls of this type. If you don't want the control tracked at all, use   */
  887. /*  the 'no track' variant.                                                             */
  888. /* Picture control proc IDs */
  889. enum {
  890.     kControlPictureProc         = 304,
  891.     kControlPictureNoTrackProc  = 305                           /* immediately returns kControlPicturePart*/
  892. };
  893. /*--------------------------------------------------------------------------------------*/
  894. /*  o ICON CONTROL (CDEF 20)                                                            */
  895. /*--------------------------------------------------------------------------------------*/
  896. /*  Value parameter should contain the ID of the ICON or cicn you wish to display when  */
  897. /*  creating controls of this type. If you don't want the control tracked at all, use   */
  898. /*  the 'no track' variant.                                                             */
  899. /* Icon control proc IDs */
  900. enum {
  901.     kControlIconProc            = 320,
  902.     kControlIconNoTrackProc     = 321,                          /* immediately returns kControlIconPart*/
  903.     kControlIconSuiteProc       = 322,
  904.     kControlIconSuiteNoTrackProc = 323                          /* immediately returns kControlIconPart*/
  905. };
  906. enum {
  907.                                                                 /* icon ref controls may have either an icon, color icon, icon suite, or icon ref.*/
  908.                                                                 /* for data other than icon, you must set the data by passing a*/
  909.                                                                 /* ControlButtonContentInfo to SetControlData*/
  910.     kControlIconRefProc         = 324,
  911.     kControlIconRefNoTrackProc  = 325                           /* immediately returns kControlIconPart*/
  912. };
  913. /* Tagged data supported by icon controls */
  914. enum {
  915.     kControlIconTransformTag    = FOUR_CHAR_CODE('trfm'),       /* IconTransformType*/
  916.     kControlIconAlignmentTag    = FOUR_CHAR_CODE('algn')        /* IconAlignmentType*/
  917. };
  918. /* Tags available with appearance 1.1 or later */
  919. enum {
  920.     kControlIconResourceIDTag   = FOUR_CHAR_CODE('ires'),       /* SInt16 resource ID of icon to use*/
  921.     kControlIconContentTag      = FOUR_CHAR_CODE('cont')        /* accepts a ControlButtonContentInfo*/
  922. };
  923. /*--------------------------------------------------------------------------------------*/
  924. /*  o WINDOW HEADER (CDEF 21)                                                           */
  925. /*--------------------------------------------------------------------------------------*/
  926. /* Window Header proc IDs */
  927. enum {
  928.     kControlWindowHeaderProc    = 336,                          /* normal header*/
  929.     kControlWindowListViewHeaderProc = 337                      /* variant for list views - no bottom line*/
  930. };
  931. /*--------------------------------------------------------------------------------------*/
  932. /*  o LIST BOX (CDEF 22)                                                                */
  933. /*--------------------------------------------------------------------------------------*/
  934. /*  Lists use an auxiliary resource to define their format. The resource type used is   */
  935. /*  'ldes' and a definition for it can be found in Appearance.r. The resource ID for    */
  936. /*  the ldes is passed in the 'value' parameter when creating the control. You may pass */
  937. /*  zero in value. This tells the List Box control to not use a resource. The list will */
  938. /*  be created with default values, and will use the standard LDEF (0). You can change  */
  939. /*  the list by getting the list handle. You can set the LDEF to use by using the tag   */
  940. /*  below (kControlListBoxLDEFTag)                                                      */
  941. /* List Box proc IDs */
  942. enum {
  943.     kControlListBoxProc         = 352,
  944.     kControlListBoxAutoSizeProc = 353
  945. };
  946. /* Tagged data supported by list box */
  947. enum {
  948.     kControlListBoxListHandleTag = FOUR_CHAR_CODE('lhan'),      /* ListHandle*/
  949.     kControlListBoxKeyFilterTag = kControlKeyFilterTag,         /* ControlKeyFilterUPP*/
  950.     kControlListBoxFontStyleTag = kControlFontStyleTag          /* ControlFontStyleRec*/
  951. };
  952. /* New tags in 1.0.1 or later */
  953. enum {
  954.     kControlListBoxDoubleClickTag = FOUR_CHAR_CODE('dblc'),     /* Boolean. Was last click a double-click?*/
  955.     kControlListBoxLDEFTag      = FOUR_CHAR_CODE('ldef')        /* SInt16. ID of LDEF to use.*/
  956. };
  957. /*--------------------------------------------------------------------------------------*/
  958. /*  o PUSH BUTTON (CDEF 23)                                                             */
  959. /*--------------------------------------------------------------------------------------*/
  960. /*  The new standard checkbox and radio button controls support a "mixed" value that    */
  961. /*  indicates that the current setting contains a mixed set of on and off values. The   */
  962. /*  control value used to display this indication is defined in Controls.h:             */
  963. /*                                                                                      */
  964. /*      kControlCheckBoxMixedValue = 2                                                  */
  965. /*                                                                                      */
  966. /*  Two new variants of the standard pushbutton have been added to the standard control */
  967. /*  suite that draw a color icon next to the control title. One variant draws the icon  */
  968. /*  on the left side, the other draws it on the right side (when the system justifica-  */
  969. /*  tion is right to left, these are reversed).                                         */
  970. /*                                                                                      */
  971. /*  When either of the icon pushbuttons are created, the contrlMax field of the control */
  972. /*  record is used to determine the ID of the 'cicn' resource drawn in the pushbutton.  */
  973. /*                                                                                      */
  974. /*  In addition, a push button can now be told to draw with a default outline using the */
  975. /*  SetControlData routine with the kPushButtonDefaultTag below.                        */
  976. /*                                                                                      */
  977. /*  A push button may also be marked using the kControlPushButtonCancelTag. This has    */
  978. /*  no visible representation, but does cause the button to play the CancelButton theme */
  979. /*  sound instead of the regular pushbutton theme sound when pressed.                   */
  980. /*                                                                                      */
  981. /* Theme Push Button/Check Box/Radio Button proc IDs */
  982. enum {
  983.     kControlPushButtonProc      = 368,
  984.     kControlCheckBoxProc        = 369,
  985.     kControlRadioButtonProc     = 370,
  986.     kControlPushButLeftIconProc = 374,                          /* Standard pushbutton with left-side icon*/
  987.     kControlPushButRightIconProc = 375                          /* Standard pushbutton with right-side icon*/
  988. };
  989. /* Variants with Appearance 1.1 or later */
  990. enum {
  991.     kControlCheckBoxAutoToggleProc = 371,
  992.     kControlRadioButtonAutoToggleProc = 372
  993. };
  994. /* Tagged data supported by standard buttons */
  995. enum {
  996.     kControlPushButtonDefaultTag = FOUR_CHAR_CODE('dflt'),      /* default ring flag*/
  997.     kControlPushButtonCancelTag = FOUR_CHAR_CODE('cncl')        /* cancel button flag (1.1 and later)*/
  998. };
  999. /*--------------------------------------------------------------------------------------*/
  1000. /*  o SCROLL BAR (CDEF 24)                                                              */
  1001. /*--------------------------------------------------------------------------------------*/
  1002. /*  This is the new Appearance scroll bar.                                              */
  1003. /*                                                                                      */
  1004. /* Theme Scroll Bar proc IDs */
  1005. enum {
  1006.     kControlScrollBarProc       = 384,                          /* normal scroll bar*/
  1007.     kControlScrollBarLiveProc   = 386                           /* live scrolling variant*/
  1008. };
  1009. /*--------------------------------------------------------------------------------------*/
  1010. /*  o POPUP BUTTON (CDEF 25)                                                            */
  1011. /*--------------------------------------------------------------------------------------*/
  1012. /*  This is the new Appearance Popup Button. It takes the same variants and does the    */
  1013. /*  same overloading as the previous popup menu control. There are some differences:    */
  1014. /*                                                                                      */
  1015. /*  Passing in a menu ID of -12345 causes the popup not to try and get the menu from a  */
  1016. /*  resource. Instead, you can build the menu and later stuff the menuhandle field in   */
  1017. /*  the popup data information.                                                         */
  1018. /*                                                                                      */
  1019. /*  You can pass -1 in the Max parameter to have the control calculate the width of the */
  1020. /*  title on its own instead of guessing and then tweaking to get it right. It adds the */
  1021. /*  appropriate amount of space between the title and the popup.                        */
  1022. /*                                                                                      */
  1023. /* Theme Popup Button proc IDs */
  1024. enum {
  1025.     kControlPopupButtonProc     = 400,
  1026.     kControlPopupFixedWidthVariant = 1 << 0,
  1027.     kControlPopupVariableWidthVariant = 1 << 1,
  1028.     kControlPopupUseAddResMenuVariant = 1 << 2,
  1029.     kControlPopupUseWFontVariant = kControlUsesOwningWindowsFontVariant
  1030. };
  1031. /* These tags are available in 1.0.1 or later of Appearance */
  1032. enum {
  1033.     kControlPopupButtonMenuHandleTag = FOUR_CHAR_CODE('mhan'),  /* MenuHandle*/
  1034.     kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid')       /* SInt16*/
  1035. };
  1036. /* These tags are available in 1.1 or later of Appearance */
  1037. enum {
  1038.     kControlPopupButtonExtraHeightTag = FOUR_CHAR_CODE('exht')  /* SInt16 extra vertical whitespace within the button*/
  1039. };
  1040. /*--------------------------------------------------------------------------------------*/
  1041. /*  o RADIO GROUP (CDEF 26)                                                             */
  1042. /*--------------------------------------------------------------------------------------*/
  1043. /*  This control implements a radio group. It is an embedding control and can therefore */
  1044. /*  only be used when a control hierarchy is established for its owning window. You     */
  1045. /*  should only embed radio buttons within it. As radio buttons are embedded into it,   */
  1046. /*  the group sets up its value, min, and max to represent the number of embedded items.*/
  1047. /*  The current value of the control is the index of the sub-control that is the current*/
  1048. /*  'on' radio button. To get the current radio button control handle, you can use the  */
  1049. /*  control manager call GetIndSubControl, passing in the value of the radio group.     */
  1050. /*                                                                                      */
  1051. /*  NOTE: This control is only available with Appearance 1.0.1.                         */
  1052. /* Radio Group Proc ID */
  1053. enum {
  1054.     kControlRadioGroupProc      = 416
  1055. };
  1056. /*--------------------------------------------------------------------------------------*/
  1057. /*  o SCROLL TEXT BOX (CDEF 27)                                                         */
  1058. /*--------------------------------------------------------------------------------------*/
  1059. /*  This control implements a scrolling box of (non-editable) text. This is useful for  */
  1060. /*  credits in about boxes, etc.                                                        */
  1061. /*  The standard version of this control has a scroll bar, but the autoscrolling        */
  1062. /*  variant does not. The autoscrolling variant needs two pieces of information to      */
  1063. /*  work: delay (in ticks) before the scrolling starts, and time (in ticks) between     */
  1064. /*  scrolls. It will scroll one pixel at a time, unless changed via SetControlData.     */
  1065. /*                                                                                      */
  1066. /*  Parameter                   What Goes Here                                          */
  1067. /*  -------------------         ----------------------------------------------------    */
  1068. /*  Value                       Resource ID of 'TEXT'/'styl' content.                   */
  1069. /*  Min                         Scroll start delay (in ticks)                       .   */
  1070. /*  Max                         Delay (in ticks) between scrolls.                       */
  1071. /*                                                                                      */
  1072. /*  NOTE: This control is only available with Appearance 1.1.                           */
  1073. /* Scroll Text Box Proc IDs */
  1074. enum {
  1075.     kControlScrollTextBoxProc   = 432,
  1076.     kControlScrollTextBoxAutoScrollProc = 433
  1077. };
  1078. /* Tagged data supported by Scroll Text Box */
  1079. enum {
  1080.     kControlScrollTextBoxDelayBeforeAutoScrollTag = FOUR_CHAR_CODE('stdl'), /* UInt32 (ticks until autoscrolling starts)*/
  1081.     kControlScrollTextBoxDelayBetweenAutoScrollTag = FOUR_CHAR_CODE('scdl'), /* UInt32 (ticks between scrolls)*/
  1082.     kControlScrollTextBoxAutoScrollAmountTag = FOUR_CHAR_CODE('samt'), /* UInt16 (pixels per scroll) -- defaults to 1*/
  1083.     kControlScrollTextBoxContentsTag = FOUR_CHAR_CODE('tres')   /* SInt16 (resource ID of 'TEXT'/'styl') -- write only!*/
  1084. };
  1085. #if OLDROUTINENAMES
  1086. /*--------------------------------------------------------------------------------------*/
  1087. /*  o OLDROUTINENAMES                                                                   */
  1088. /*--------------------------------------------------------------------------------------*/
  1089. enum {
  1090.     kControlCheckboxUncheckedValue = kControlCheckBoxUncheckedValue,
  1091.     kControlCheckboxCheckedValue = kControlCheckBoxCheckedValue,
  1092.     kControlCheckboxMixedValue  = kControlCheckBoxMixedValue
  1093. };
  1094. enum {
  1095.     inLabel                     = kControlLabelPart,
  1096.     inMenu                      = kControlMenuPart,
  1097.     inTriangle                  = kControlTrianglePart,
  1098.     inButton                    = kControlButtonPart,
  1099.     inCheckBox                  = kControlCheckBoxPart,
  1100.     inUpButton                  = kControlUpButtonPart,
  1101.     inDownButton                = kControlDownButtonPart,
  1102.     inPageUp                    = kControlPageUpPart,
  1103.     inPageDown                  = kControlPageDownPart
  1104. };
  1105. enum {
  1106.     kInLabelControlPart         = kControlLabelPart,
  1107.     kInMenuControlPart          = kControlMenuPart,
  1108.     kInTriangleControlPart      = kControlTrianglePart,
  1109.     kInButtonControlPart        = kControlButtonPart,
  1110.     kInCheckBoxControlPart      = kControlCheckBoxPart,
  1111.     kInUpButtonControlPart      = kControlUpButtonPart,
  1112.     kInDownButtonControlPart    = kControlDownButtonPart,
  1113.     kInPageUpControlPart        = kControlPageUpPart,
  1114.     kInPageDownControlPart      = kControlPageDownPart
  1115. };
  1116. #endif  /* OLDROUTINENAMES */
  1117. #if PRAGMA_STRUCT_ALIGN
  1118.     #pragma options align=reset
  1119. #elif PRAGMA_STRUCT_PACKPUSH
  1120.     #pragma pack(pop)
  1121. #elif PRAGMA_STRUCT_PACK
  1122.     #pragma pack()
  1123. #endif
  1124. #ifdef PRAGMA_IMPORT_OFF
  1125. #pragma import off
  1126. #elif PRAGMA_IMPORT
  1127. #pragma import reset
  1128. #endif
  1129. #ifdef __cplusplus
  1130. }
  1131. #endif
  1132. #endif /* __CONTROLDEFINITIONS__ */