HITabbedView.pas 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. {
  2. File: HIToolbox/HITabbedView.h
  3. Contains: Definition of the tab view provided by HIToolbox.
  4. Version: HIToolbox-624~3
  5. Copyright: © 2006-2008 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Initial Pascal Translation: Jonas Maebe, <[email protected]>, October 2009 }
  11. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  12. {
  13. Modified for use with Free Pascal
  14. Version 308
  15. Please report any bugs to <[email protected]>
  16. }
  17. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  18. {$mode macpas}
  19. {$packenum 1}
  20. {$macro on}
  21. {$inline on}
  22. {$calling mwpascal}
  23. unit HITabbedView;
  24. interface
  25. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  26. {$setc GAP_INTERFACES_VERSION := $0308}
  27. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  28. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  29. {$endc}
  30. {$ifc defined CPUPOWERPC and defined CPUI386}
  31. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  32. {$endc}
  33. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  34. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  35. {$endc}
  36. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  37. {$setc __ppc__ := 1}
  38. {$elsec}
  39. {$setc __ppc__ := 0}
  40. {$endc}
  41. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  42. {$setc __ppc64__ := 1}
  43. {$elsec}
  44. {$setc __ppc64__ := 0}
  45. {$endc}
  46. {$ifc not defined __i386__ and defined CPUI386}
  47. {$setc __i386__ := 1}
  48. {$elsec}
  49. {$setc __i386__ := 0}
  50. {$endc}
  51. {$ifc not defined __x86_64__ and defined CPUX86_64}
  52. {$setc __x86_64__ := 1}
  53. {$elsec}
  54. {$setc __x86_64__ := 0}
  55. {$endc}
  56. {$ifc not defined __arm__ and defined CPUARM}
  57. {$setc __arm__ := 1}
  58. {$elsec}
  59. {$setc __arm__ := 0}
  60. {$endc}
  61. {$ifc defined cpu64}
  62. {$setc __LP64__ := 1}
  63. {$elsec}
  64. {$setc __LP64__ := 0}
  65. {$endc}
  66. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  67. {$error Conflicting definitions for __ppc__ and __i386__}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__}
  70. {$setc TARGET_CPU_PPC := TRUE}
  71. {$setc TARGET_CPU_PPC64 := FALSE}
  72. {$setc TARGET_CPU_X86 := FALSE}
  73. {$setc TARGET_CPU_X86_64 := FALSE}
  74. {$setc TARGET_CPU_ARM := FALSE}
  75. {$setc TARGET_OS_MAC := TRUE}
  76. {$setc TARGET_OS_IPHONE := FALSE}
  77. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  78. {$setc TARGET_OS_EMBEDDED := FALSE}
  79. {$elifc defined __ppc64__ and __ppc64__}
  80. {$setc TARGET_CPU_PPC := FALSE}
  81. {$setc TARGET_CPU_PPC64 := TRUE}
  82. {$setc TARGET_CPU_X86 := FALSE}
  83. {$setc TARGET_CPU_X86_64 := FALSE}
  84. {$setc TARGET_CPU_ARM := FALSE}
  85. {$setc TARGET_OS_MAC := TRUE}
  86. {$setc TARGET_OS_IPHONE := FALSE}
  87. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  88. {$setc TARGET_OS_EMBEDDED := FALSE}
  89. {$elifc defined __i386__ and __i386__}
  90. {$setc TARGET_CPU_PPC := FALSE}
  91. {$setc TARGET_CPU_PPC64 := FALSE}
  92. {$setc TARGET_CPU_X86 := TRUE}
  93. {$setc TARGET_CPU_X86_64 := FALSE}
  94. {$setc TARGET_CPU_ARM := FALSE}
  95. {$ifc defined(iphonesim)}
  96. {$setc TARGET_OS_MAC := FALSE}
  97. {$setc TARGET_OS_IPHONE := TRUE}
  98. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  99. {$elsec}
  100. {$setc TARGET_OS_MAC := TRUE}
  101. {$setc TARGET_OS_IPHONE := FALSE}
  102. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  103. {$endc}
  104. {$setc TARGET_OS_EMBEDDED := FALSE}
  105. {$elifc defined __x86_64__ and __x86_64__}
  106. {$setc TARGET_CPU_PPC := FALSE}
  107. {$setc TARGET_CPU_PPC64 := FALSE}
  108. {$setc TARGET_CPU_X86 := FALSE}
  109. {$setc TARGET_CPU_X86_64 := TRUE}
  110. {$setc TARGET_CPU_ARM := FALSE}
  111. {$setc TARGET_OS_MAC := TRUE}
  112. {$setc TARGET_OS_IPHONE := FALSE}
  113. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  114. {$setc TARGET_OS_EMBEDDED := FALSE}
  115. {$elifc defined __arm__ and __arm__}
  116. {$setc TARGET_CPU_PPC := FALSE}
  117. {$setc TARGET_CPU_PPC64 := FALSE}
  118. {$setc TARGET_CPU_X86 := FALSE}
  119. {$setc TARGET_CPU_X86_64 := FALSE}
  120. {$setc TARGET_CPU_ARM := TRUE}
  121. { will require compiler define when/if other Apple devices with ARM cpus ship }
  122. {$setc TARGET_OS_MAC := FALSE}
  123. {$setc TARGET_OS_IPHONE := TRUE}
  124. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  125. {$setc TARGET_OS_EMBEDDED := TRUE}
  126. {$elsec}
  127. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  128. {$endc}
  129. {$ifc defined __LP64__ and __LP64__ }
  130. {$setc TARGET_CPU_64 := TRUE}
  131. {$elsec}
  132. {$setc TARGET_CPU_64 := FALSE}
  133. {$endc}
  134. {$ifc defined FPC_BIG_ENDIAN}
  135. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  136. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  137. {$elifc defined FPC_LITTLE_ENDIAN}
  138. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  139. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  140. {$elsec}
  141. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  142. {$endc}
  143. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  144. {$setc CALL_NOT_IN_CARBON := FALSE}
  145. {$setc OLDROUTINENAMES := FALSE}
  146. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  147. {$setc OPAQUE_UPP_TYPES := TRUE}
  148. {$setc OTCARBONAPPLICATION := TRUE}
  149. {$setc OTKERNEL := FALSE}
  150. {$setc PM_USE_SESSION_APIS := TRUE}
  151. {$setc TARGET_API_MAC_CARBON := TRUE}
  152. {$setc TARGET_API_MAC_OS8 := FALSE}
  153. {$setc TARGET_API_MAC_OSX := TRUE}
  154. {$setc TARGET_CARBON := TRUE}
  155. {$setc TARGET_CPU_68K := FALSE}
  156. {$setc TARGET_CPU_MIPS := FALSE}
  157. {$setc TARGET_CPU_SPARC := FALSE}
  158. {$setc TARGET_OS_UNIX := FALSE}
  159. {$setc TARGET_OS_WIN32 := FALSE}
  160. {$setc TARGET_RT_MAC_68881 := FALSE}
  161. {$setc TARGET_RT_MAC_CFM := FALSE}
  162. {$setc TARGET_RT_MAC_MACHO := TRUE}
  163. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  164. {$setc TYPE_BOOL := FALSE}
  165. {$setc TYPE_EXTENDED := FALSE}
  166. {$setc TYPE_LONGLONG := TRUE}
  167. uses MacTypes,Appearance,CarbonEvents,Controls,QuickdrawTypes,CFBase,HIObject;
  168. {$endc} {not MACOSALLINCLUDE}
  169. {$ifc TARGET_OS_MAC}
  170. {$ALIGN MAC68K}
  171. {
  172. * HITabbedView.h
  173. *
  174. * Discussion:
  175. * API definitions for the tab view.
  176. }
  177. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  178. { ¥ TABS (CDEF 8) }
  179. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  180. { Tabs use an auxiliary resource (tab#) to hold tab information such as the tab name }
  181. { and an icon suite ID for each tab. }
  182. { The ID of the tab# resource that you wish to associate with a tab control should }
  183. { be passed in as the Value parameter of the control. If you are using GetNewControl, }
  184. { then the Value slot in the CNTL resource should have the ID of the 'tab#' resource }
  185. { on creation. }
  186. { Passing zero in for the tab# resource tells the control not to read in a tab# res. }
  187. { You can then use SetControlMaximum to add tabs, followed by a call to SetControlData}
  188. { with the kControlTabInfoTag, passing in a pointer to a ControlTabInfoRec. This sets }
  189. { the name and optionally an icon for a tab. Pass the 1-based tab index as the part }
  190. { code parameter to SetControlData to indicate the tab that you want to modify. }
  191. { Accessibility Notes: Those of you who wish to customize the accessibility }
  192. { information provided for individual tabs of a tabs control -- by handling various }
  193. { kEventClassAccessibility Carbon Events, by calling }
  194. { HIObjectSetAuxiliaryAccessibilityAttribute, etc. -- need to know how to interpret }
  195. { and/or build AXUIElementRefs that represent individual tabs. The AXUIElement }
  196. { representing an individual tab will/must be constructed using the tab control's }
  197. { ControlRef and the UInt64 identifier of the one-based index of the tab the element }
  198. { refers to. As usual, a UInt64 identifier of zero represents the tabs control as a }
  199. { whole. You must neither interpret nor create tab control elements whose identifiers }
  200. { are greater than the count of tabs in the tabs control. }
  201. { Tabs proc IDs }
  202. const
  203. kControlTabLargeProc = 128; { Large tab size, north facing }
  204. kControlTabSmallProc = 129; { Small tab size, north facing }
  205. kControlTabLargeNorthProc = 128; { Large tab size, north facing }
  206. kControlTabSmallNorthProc = 129; { Small tab size, north facing }
  207. kControlTabLargeSouthProc = 130; { Large tab size, south facing }
  208. kControlTabSmallSouthProc = 131; { Small tab size, south facing }
  209. kControlTabLargeEastProc = 132; { Large tab size, east facing }
  210. kControlTabSmallEastProc = 133; { Small tab size, east facing }
  211. kControlTabLargeWestProc = 134; { Large tab size, west facing }
  212. kControlTabSmallWestProc = 135; { Small tab size, west facing }
  213. { Tab Directions }
  214. type
  215. ControlTabDirection = UInt16;
  216. const
  217. kControlTabDirectionNorth = 0;
  218. kControlTabDirectionSouth = 1;
  219. kControlTabDirectionEast = 2;
  220. kControlTabDirectionWest = 3;
  221. { Tab Sizes }
  222. type
  223. ControlTabSize = UInt16;
  224. const
  225. kControlTabSizeLarge = kControlSizeNormal;
  226. kControlTabSizeSmall = kControlSizeSmall;
  227. kControlTabSizeMini = kControlSizeMini;
  228. { Control Tab Entry - used during creation }
  229. { Note that the client is responsible for allocating/providing }
  230. { the ControlButtonContentInfo and string storage for this }
  231. { structure. }
  232. type
  233. ControlTabEntry = record
  234. icon: ControlButtonContentInfoPtr;
  235. name: CFStringRef;
  236. enabled: Boolean;
  237. end;
  238. { Control Kind Tag }
  239. const
  240. kControlKindTabs = FourCharCode('tabs');
  241. { The HIObject class ID for the HITabbedView class. }
  242. {$ifc USE_CFSTR_CONSTANT_MACROS}
  243. {$definec kHITabbedViewClassID CFSTRP('com.apple.HITabbedView')}
  244. {$endc}
  245. { Creation API: Carbon only }
  246. {$ifc not TARGET_CPU_64}
  247. {
  248. * CreateTabsControl()
  249. *
  250. * Mac OS X threading:
  251. * Not thread safe
  252. *
  253. * Availability:
  254. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  255. * CarbonLib: in CarbonLib 1.1 and later
  256. * Non-Carbon CFM: not available
  257. }
  258. function CreateTabsControl( window: WindowRef; const (*var*) boundsRect: Rect; size: ControlTabSize; direction: ControlTabDirection; numTabs: UInt16; const (*var*) tabArray: ControlTabEntry; var outControl: ControlRef ): OSStatus; external name '_CreateTabsControl';
  259. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  260. {$endc} {not TARGET_CPU_64}
  261. {
  262. * Summary:
  263. * Tagged data supported by the Tabs control.
  264. }
  265. const
  266. {
  267. * Used to get the bounds of the control area benath the tabs. Cannot
  268. * be used with SetControlData. Data is of type Rect.
  269. }
  270. kControlTabContentRectTag = FourCharCode('rect');
  271. {
  272. * Used to get or set the enable state of a specific tab. The part
  273. * code parameter to Get/SetControlData must be a 1-based tab index.
  274. * Data is of type Boolean.
  275. }
  276. kControlTabEnabledFlagTag = FourCharCode('enab');
  277. {
  278. * Used to get or set the font and style attributes of a specific
  279. * tab. The part code parameter to Get/SetControlData must be a
  280. * 1-based tab index. Data is of type ControlFontStyleRec.
  281. }
  282. kControlTabFontStyleTag = kControlFontStyleTag;
  283. {
  284. * Used to get or set the name and image of a specified tab. The part
  285. * code parameter to Get/SetControlData must be a 1-based tab index.
  286. * Data is of type ControlTabInfoRec. Available in Appearance Manager
  287. * 1.0.1 and later.
  288. }
  289. kControlTabInfoTag = FourCharCode('tabi');
  290. {
  291. * Used to get or set the image of a specified tab. The part code
  292. * parameter to Get/SetControlData must be a 1-based tab index. When
  293. * used with GetControlData, if the tab image is an IconRef or
  294. * CGImageRef, the Tabs control will automatically retain the icon or
  295. * image, and the caller of GetControlData must release it. Data is
  296. * of type ControlImageContentInfo, or HIViewContentInfo. Available
  297. * in Mac OS X 10.1 and later.
  298. }
  299. kControlTabImageContentTag = kControlContentTag;
  300. const
  301. kControlTabInfoVersionZero = 0; { ControlTabInfoRec}
  302. kControlTabInfoVersionOne = 1; { ControlTabInfoRecV1}
  303. type
  304. ControlTabInfoRec = record
  305. version: SInt16; { version of this structure.}
  306. iconSuiteID: SInt16; { icon suite to use. Zero indicates no icon}
  307. name: Str255; { name to be displayed on the tab}
  308. end;
  309. type
  310. ControlTabInfoRecV1 = record
  311. version: SInt16; { version of this structure. == kControlTabInfoVersionOne}
  312. iconSuiteID: SInt16; { icon suite to use. Zero indicates no icon}
  313. name: CFStringRef; { name to be displayed on the tab. Will be retained so caller}
  314. { should always release it.}
  315. end;
  316. { Helper routines are available only thru the shared library/glue. }
  317. {$ifc not TARGET_CPU_64}
  318. {
  319. * GetTabContentRect()
  320. *
  321. * Mac OS X threading:
  322. * Not thread safe
  323. *
  324. * Availability:
  325. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  326. * CarbonLib: in CarbonLib 1.0 and later
  327. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  328. }
  329. function GetTabContentRect( inTabControl: ControlRef; var outContentRect: Rect ): OSErr; external name '_GetTabContentRect';
  330. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  331. {
  332. * SetTabEnabled()
  333. *
  334. * Mac OS X threading:
  335. * Not thread safe
  336. *
  337. * Availability:
  338. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  339. * CarbonLib: in CarbonLib 1.0 and later
  340. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  341. }
  342. function SetTabEnabled( inTabControl: ControlRef; inTabToHilite: SInt16; inEnabled: Boolean ): OSErr; external name '_SetTabEnabled';
  343. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  344. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  345. { ¥ Resource Types }
  346. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  347. {$endc} {not TARGET_CPU_64}
  348. const
  349. kControlTabListResType = FourCharCode('tab#'); { used for tab control (Appearance 1.0 and later)}
  350. {$endc} {TARGET_OS_MAC}
  351. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  352. end.
  353. {$endc} {not MACOSALLINCLUDE}