HITabbedView.pas 15 KB

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