Icons.pas 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013
  1. {
  2. File: Icons.p
  3. Contains: Icon Utilities and Icon Services Interfaces.
  4. Version: Technology: Mac OS 9.x
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1990-2002 by Apple Computer, Inc. All rights reserved
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit Icons;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,CFBase,CGGeometry,Quickdraw,Files,CodeFragments,CGContext;
  92. {$ALIGN MAC68K}
  93. { The following are icons for which there are both icon suites and SICNs. }
  94. { Avoid using icon resources if possible. Use IconServices instead. }
  95. const
  96. kGenericDocumentIconResource = -4000;
  97. kGenericStationeryIconResource = -3985;
  98. kGenericEditionFileIconResource = -3989;
  99. kGenericApplicationIconResource = -3996;
  100. kGenericDeskAccessoryIconResource = -3991;
  101. kGenericFolderIconResource = -3999;
  102. kPrivateFolderIconResource = -3994;
  103. kFloppyIconResource = -3998;
  104. kTrashIconResource = -3993;
  105. kGenericRAMDiskIconResource = -3988;
  106. kGenericCDROMIconResource = -3987;
  107. { The following are icons for which there are SICNs only. }
  108. { Avoid using icon resources if possible. Use IconServices instead. }
  109. kDesktopIconResource = -3992;
  110. kOpenFolderIconResource = -3997;
  111. kGenericHardDiskIconResource = -3995;
  112. kGenericFileServerIconResource = -3972;
  113. kGenericSuitcaseIconResource = -3970;
  114. kGenericMoverObjectIconResource = -3969;
  115. { The following are icons for which there are icon suites only. }
  116. { Avoid using icon resources if possible. Use IconServices instead. }
  117. kGenericPreferencesIconResource = -3971;
  118. kGenericQueryDocumentIconResource = -16506;
  119. kGenericExtensionIconResource = -16415;
  120. kSystemFolderIconResource = -3983;
  121. kHelpIconResource = -20271;
  122. kAppleMenuFolderIconResource = -3982;
  123. { Obsolete. Use named constants defined above. }
  124. genericDocumentIconResource = -4000;
  125. genericStationeryIconResource = -3985;
  126. genericEditionFileIconResource = -3989;
  127. genericApplicationIconResource = -3996;
  128. genericDeskAccessoryIconResource = -3991;
  129. genericFolderIconResource = -3999;
  130. privateFolderIconResource = -3994;
  131. floppyIconResource = -3998;
  132. trashIconResource = -3993;
  133. genericRAMDiskIconResource = -3988;
  134. genericCDROMIconResource = -3987;
  135. desktopIconResource = -3992;
  136. openFolderIconResource = -3997;
  137. genericHardDiskIconResource = -3995;
  138. genericFileServerIconResource = -3972;
  139. genericSuitcaseIconResource = -3970;
  140. genericMoverObjectIconResource = -3969;
  141. genericPreferencesIconResource = -3971;
  142. genericQueryDocumentIconResource = -16506;
  143. genericExtensionIconResource = -16415;
  144. systemFolderIconResource = -3983;
  145. appleMenuFolderIconResource = -3982;
  146. { Avoid using icon resources if possible. Use IconServices instead. }
  147. kStartupFolderIconResource = -3981;
  148. kOwnedFolderIconResource = -3980;
  149. kDropFolderIconResource = -3979;
  150. kSharedFolderIconResource = -3978;
  151. kMountedFolderIconResource = -3977;
  152. kControlPanelFolderIconResource = -3976;
  153. kPrintMonitorFolderIconResource = -3975;
  154. kPreferencesFolderIconResource = -3974;
  155. kExtensionsFolderIconResource = -3973;
  156. kFontsFolderIconResource = -3968;
  157. kFullTrashIconResource = -3984;
  158. { Obsolete. Use named constants defined above. }
  159. startupFolderIconResource = -3981;
  160. ownedFolderIconResource = -3980;
  161. dropFolderIconResource = -3979;
  162. sharedFolderIconResource = -3978;
  163. mountedFolderIconResource = -3977;
  164. controlPanelFolderIconResource = -3976;
  165. printMonitorFolderIconResource = -3975;
  166. preferencesFolderIconResource = -3974;
  167. extensionsFolderIconResource = -3973;
  168. fontsFolderIconResource = -3968;
  169. fullTrashIconResource = -3984;
  170. { The following icon types can only be used as an icon element }
  171. { inside a 'icns' icon family }
  172. kThumbnail32BitData = $69743332 (* 'it32' *);
  173. kThumbnail8BitMask = $74386D6B (* 't8mk' *);
  174. kHuge1BitMask = $69636823 (* 'ich#' *);
  175. kHuge4BitData = $69636834 (* 'ich4' *);
  176. kHuge8BitData = $69636838 (* 'ich8' *);
  177. kHuge32BitData = $69683332 (* 'ih32' *);
  178. kHuge8BitMask = $68386D6B (* 'h8mk' *);
  179. { The following icon types can be used as a resource type }
  180. { or as an icon element type inside a 'icns' icon family }
  181. kLarge1BitMask = $49434E23 (* 'ICN#' *);
  182. kLarge4BitData = $69636C34 (* 'icl4' *);
  183. kLarge8BitData = $69636C38 (* 'icl8' *);
  184. kLarge32BitData = $696C3332 (* 'il32' *);
  185. kLarge8BitMask = $6C386D6B (* 'l8mk' *);
  186. kSmall1BitMask = $69637323 (* 'ics#' *);
  187. kSmall4BitData = $69637334 (* 'ics4' *);
  188. kSmall8BitData = $69637338 (* 'ics8' *);
  189. kSmall32BitData = $69733332 (* 'is32' *);
  190. kSmall8BitMask = $73386D6B (* 's8mk' *);
  191. kMini1BitMask = $69636D23 (* 'icm#' *);
  192. kMini4BitData = $69636D34 (* 'icm4' *);
  193. kMini8BitData = $69636D38 (* 'icm8' *);
  194. { Icon Variants }
  195. { These can be used as an element of an 'icns' icon family }
  196. { or as a parameter to GetIconRefVariant }
  197. kTileIconVariant = $74696C65 (* 'tile' *);
  198. kRolloverIconVariant = $6F766572 (* 'over' *);
  199. kDropIconVariant = $64726F70 (* 'drop' *);
  200. kOpenIconVariant = $6F70656E (* 'open' *);
  201. kOpenDropIconVariant = $6F647270 (* 'odrp' *);
  202. { Obsolete. Use names defined above. }
  203. large1BitMask = $49434E23 (* 'ICN#' *);
  204. large4BitData = $69636C34 (* 'icl4' *);
  205. large8BitData = $69636C38 (* 'icl8' *);
  206. small1BitMask = $69637323 (* 'ics#' *);
  207. small4BitData = $69637334 (* 'ics4' *);
  208. small8BitData = $69637338 (* 'ics8' *);
  209. mini1BitMask = $69636D23 (* 'icm#' *);
  210. mini4BitData = $69636D34 (* 'icm4' *);
  211. mini8BitData = $69636D38 (* 'icm8' *);
  212. { Alignment type values. }
  213. kAlignNone = $00;
  214. kAlignVerticalCenter = $01;
  215. kAlignTop = $02;
  216. kAlignBottom = $03;
  217. kAlignHorizontalCenter = $04;
  218. kAlignAbsoluteCenter = $05;
  219. kAlignCenterTop = $06;
  220. kAlignCenterBottom = $07;
  221. kAlignLeft = $08;
  222. kAlignCenterLeft = $09;
  223. kAlignTopLeft = $0A;
  224. kAlignBottomLeft = $0B;
  225. kAlignRight = $0C;
  226. kAlignCenterRight = $0D;
  227. kAlignTopRight = $0E;
  228. kAlignBottomRight = $0F;
  229. { Obsolete. Use names defined above. }
  230. atNone = $00;
  231. atVerticalCenter = $01;
  232. atTop = $02;
  233. atBottom = $03;
  234. atHorizontalCenter = $04;
  235. atAbsoluteCenter = $05;
  236. atCenterTop = $06;
  237. atCenterBottom = $07;
  238. atLeft = $08;
  239. atCenterLeft = $09;
  240. atTopLeft = $0A;
  241. atBottomLeft = $0B;
  242. atRight = $0C;
  243. atCenterRight = $0D;
  244. atTopRight = $0E;
  245. atBottomRight = $0F;
  246. type
  247. IconAlignmentType = SInt16;
  248. { Transform type values. }
  249. const
  250. kTransformNone = $00;
  251. kTransformDisabled = $01;
  252. kTransformOffline = $02;
  253. kTransformOpen = $03;
  254. kTransformLabel1 = $0100;
  255. kTransformLabel2 = $0200;
  256. kTransformLabel3 = $0300;
  257. kTransformLabel4 = $0400;
  258. kTransformLabel5 = $0500;
  259. kTransformLabel6 = $0600;
  260. kTransformLabel7 = $0700;
  261. kTransformSelected = $4000;
  262. kTransformSelectedDisabled = $4001;
  263. kTransformSelectedOffline = $4002;
  264. kTransformSelectedOpen = $4003;
  265. { Obsolete. Use names defined above. }
  266. ttNone = $00;
  267. ttDisabled = $01;
  268. ttOffline = $02;
  269. ttOpen = $03;
  270. ttLabel1 = $0100;
  271. ttLabel2 = $0200;
  272. ttLabel3 = $0300;
  273. ttLabel4 = $0400;
  274. ttLabel5 = $0500;
  275. ttLabel6 = $0600;
  276. ttLabel7 = $0700;
  277. ttSelected = $4000;
  278. ttSelectedDisabled = $4001;
  279. ttSelectedOffline = $4002;
  280. ttSelectedOpen = $4003;
  281. type
  282. IconTransformType = SInt16;
  283. { Selector mask values. }
  284. const
  285. kSelectorLarge1Bit = $00000001;
  286. kSelectorLarge4Bit = $00000002;
  287. kSelectorLarge8Bit = $00000004;
  288. kSelectorLarge32Bit = $00000008;
  289. kSelectorLarge8BitMask = $00000010;
  290. kSelectorSmall1Bit = $00000100;
  291. kSelectorSmall4Bit = $00000200;
  292. kSelectorSmall8Bit = $00000400;
  293. kSelectorSmall32Bit = $00000800;
  294. kSelectorSmall8BitMask = $00001000;
  295. kSelectorMini1Bit = $00010000;
  296. kSelectorMini4Bit = $00020000;
  297. kSelectorMini8Bit = $00040000;
  298. kSelectorHuge1Bit = $01000000;
  299. kSelectorHuge4Bit = $02000000;
  300. kSelectorHuge8Bit = $04000000;
  301. kSelectorHuge32Bit = $08000000;
  302. kSelectorHuge8BitMask = $10000000;
  303. kSelectorAllLargeData = $000000FF;
  304. kSelectorAllSmallData = $0000FF00;
  305. kSelectorAllMiniData = $00FF0000;
  306. kSelectorAllHugeData = $FF000000;
  307. kSelectorAll1BitData = $01010101;
  308. kSelectorAll4BitData = $02020202;
  309. kSelectorAll8BitData = $04040404;
  310. kSelectorAll32BitData = $08000808;
  311. kSelectorAllAvailableData = $FFFFFFFF;
  312. { Obsolete. Use names defined above. }
  313. svLarge1Bit = $00000001;
  314. svLarge4Bit = $00000002;
  315. svLarge8Bit = $00000004;
  316. svSmall1Bit = $00000100;
  317. svSmall4Bit = $00000200;
  318. svSmall8Bit = $00000400;
  319. svMini1Bit = $00010000;
  320. svMini4Bit = $00020000;
  321. svMini8Bit = $00040000;
  322. svAllLargeData = $000000FF;
  323. svAllSmallData = $0000FF00;
  324. svAllMiniData = $00FF0000;
  325. svAll1BitData = $01010101;
  326. svAll4BitData = $02020202;
  327. svAll8BitData = $04040404;
  328. svAllAvailableData = $FFFFFFFF;
  329. type
  330. IconSelectorValue = UInt32;
  331. {$ifc TYPED_FUNCTION_POINTERS}
  332. IconActionProcPtr = function(theType: ResType; var theIcon: Handle; yourDataPtr: UnivPtr): OSErr;
  333. {$elsec}
  334. IconActionProcPtr = ProcPtr;
  335. {$endc}
  336. {$ifc TYPED_FUNCTION_POINTERS}
  337. IconGetterProcPtr = function(theType: ResType; yourDataPtr: UnivPtr): Handle;
  338. {$elsec}
  339. IconGetterProcPtr = ProcPtr;
  340. {$endc}
  341. {$ifc OPAQUE_UPP_TYPES}
  342. IconActionUPP = ^SInt32; { an opaque UPP }
  343. {$elsec}
  344. IconActionUPP = UniversalProcPtr;
  345. {$endc}
  346. {$ifc OPAQUE_UPP_TYPES}
  347. IconGetterUPP = ^SInt32; { an opaque UPP }
  348. {$elsec}
  349. IconGetterUPP = UniversalProcPtr;
  350. {$endc}
  351. const
  352. uppIconActionProcInfo = $00000FE0;
  353. uppIconGetterProcInfo = $000003F0;
  354. {
  355. * NewIconActionUPP()
  356. *
  357. * Availability:
  358. * Non-Carbon CFM: available as macro/inline
  359. * CarbonLib: in CarbonLib 1.0 and later
  360. * Mac OS X: in version 10.0 and later
  361. }
  362. function NewIconActionUPP(userRoutine: IconActionProcPtr): IconActionUPP; external name '_NewIconActionUPP'; { old name was NewIconActionProc }
  363. {
  364. * NewIconGetterUPP()
  365. *
  366. * Availability:
  367. * Non-Carbon CFM: available as macro/inline
  368. * CarbonLib: in CarbonLib 1.0 and later
  369. * Mac OS X: in version 10.0 and later
  370. }
  371. function NewIconGetterUPP(userRoutine: IconGetterProcPtr): IconGetterUPP; external name '_NewIconGetterUPP'; { old name was NewIconGetterProc }
  372. {
  373. * DisposeIconActionUPP()
  374. *
  375. * Availability:
  376. * Non-Carbon CFM: available as macro/inline
  377. * CarbonLib: in CarbonLib 1.0 and later
  378. * Mac OS X: in version 10.0 and later
  379. }
  380. procedure DisposeIconActionUPP(userUPP: IconActionUPP); external name '_DisposeIconActionUPP';
  381. {
  382. * DisposeIconGetterUPP()
  383. *
  384. * Availability:
  385. * Non-Carbon CFM: available as macro/inline
  386. * CarbonLib: in CarbonLib 1.0 and later
  387. * Mac OS X: in version 10.0 and later
  388. }
  389. procedure DisposeIconGetterUPP(userUPP: IconGetterUPP); external name '_DisposeIconGetterUPP';
  390. {
  391. * InvokeIconActionUPP()
  392. *
  393. * Availability:
  394. * Non-Carbon CFM: available as macro/inline
  395. * CarbonLib: in CarbonLib 1.0 and later
  396. * Mac OS X: in version 10.0 and later
  397. }
  398. function InvokeIconActionUPP(theType: ResType; var theIcon: Handle; yourDataPtr: UnivPtr; userRoutine: IconActionUPP): OSErr; external name '_InvokeIconActionUPP'; { old name was CallIconActionProc }
  399. {
  400. * InvokeIconGetterUPP()
  401. *
  402. * Availability:
  403. * Non-Carbon CFM: available as macro/inline
  404. * CarbonLib: in CarbonLib 1.0 and later
  405. * Mac OS X: in version 10.0 and later
  406. }
  407. function InvokeIconGetterUPP(theType: ResType; yourDataPtr: UnivPtr; userRoutine: IconGetterUPP): Handle; external name '_InvokeIconGetterUPP'; { old name was CallIconGetterProc }
  408. type
  409. IconGetter = IconGetterProcPtr;
  410. IconAction = IconActionProcPtr;
  411. { CIconHandle, GetCIcon(), PlotCIcon(), and DisposeCIcon() moved here from Quickdraw.h }
  412. CIconPtr = ^CIcon;
  413. CIcon = record
  414. iconPMap: PixMap; { the icon's pixMap }
  415. iconMask: BitMap; { the icon's mask }
  416. iconBMap: BitMap; { the icon's bitMap }
  417. iconData: Handle; { the icon's data }
  418. iconMaskData: array [0..0] of SInt16; { icon's mask and BitMap data }
  419. end;
  420. CIconHandle = ^CIconPtr;
  421. {
  422. * GetCIcon()
  423. *
  424. * Availability:
  425. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  426. * CarbonLib: in CarbonLib 1.0 and later
  427. * Mac OS X: in version 10.0 and later
  428. }
  429. function GetCIcon(iconID: SInt16): CIconHandle; external name '_GetCIcon';
  430. {
  431. * PlotCIcon()
  432. *
  433. * Availability:
  434. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  435. * CarbonLib: in CarbonLib 1.0 and later
  436. * Mac OS X: in version 10.0 and later
  437. }
  438. procedure PlotCIcon(const (*var*) theRect: Rect; theIcon: CIconHandle); external name '_PlotCIcon';
  439. {
  440. * DisposeCIcon()
  441. *
  442. * Availability:
  443. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  444. * CarbonLib: in CarbonLib 1.0 and later
  445. * Mac OS X: in version 10.0 and later
  446. }
  447. procedure DisposeCIcon(theIcon: CIconHandle); external name '_DisposeCIcon';
  448. { GetIcon and PlotIcon moved here from ToolUtils }
  449. {
  450. * GetIcon()
  451. *
  452. * Availability:
  453. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  454. * CarbonLib: in CarbonLib 1.0 and later
  455. * Mac OS X: in version 10.0 and later
  456. }
  457. function GetIcon(iconID: SInt16): Handle; external name '_GetIcon';
  458. {
  459. * PlotIcon()
  460. *
  461. * Availability:
  462. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  463. * CarbonLib: in CarbonLib 1.0 and later
  464. * Mac OS X: in version 10.0 and later
  465. }
  466. procedure PlotIcon(const (*var*) theRect: Rect; theIcon: Handle); external name '_PlotIcon';
  467. {
  468. Note: IconSuiteRef and IconCacheRef should be an abstract types,
  469. but too much source code already relies on them being of type Handle.
  470. }
  471. type
  472. IconSuiteRef = Handle;
  473. IconCacheRef = Handle;
  474. { IconRefs are 32-bit values identifying cached icon data. IconRef 0 is invalid. }
  475. IconRef = ^SInt32; { an opaque 32-bit type }
  476. IconRefPtr = ^IconRef; { when a var xx:IconRef parameter can be nil, it is changed to xx: IconRefPtr }
  477. {
  478. * PlotIconID()
  479. *
  480. * Availability:
  481. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  482. * CarbonLib: in CarbonLib 1.0 and later
  483. * Mac OS X: in version 10.0 and later
  484. }
  485. function PlotIconID(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theResID: SInt16): OSErr; external name '_PlotIconID';
  486. {
  487. * NewIconSuite()
  488. *
  489. * Availability:
  490. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  491. * CarbonLib: in CarbonLib 1.0 and later
  492. * Mac OS X: in version 10.0 and later
  493. }
  494. function NewIconSuite(var theIconSuite: IconSuiteRef): OSErr; external name '_NewIconSuite';
  495. {
  496. * AddIconToSuite()
  497. *
  498. * Availability:
  499. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  500. * CarbonLib: in CarbonLib 1.0 and later
  501. * Mac OS X: in version 10.0 and later
  502. }
  503. function AddIconToSuite(theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr; external name '_AddIconToSuite';
  504. {
  505. * GetIconFromSuite()
  506. *
  507. * Availability:
  508. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  509. * CarbonLib: in CarbonLib 1.0 and later
  510. * Mac OS X: in version 10.0 and later
  511. }
  512. function GetIconFromSuite(var theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr; external name '_GetIconFromSuite';
  513. {
  514. * ForEachIconDo()
  515. *
  516. * Availability:
  517. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  518. * CarbonLib: in CarbonLib 1.0 and later
  519. * Mac OS X: in version 10.0 and later
  520. }
  521. function ForEachIconDo(theSuite: IconSuiteRef; selector: IconSelectorValue; action: IconActionUPP; yourDataPtr: UnivPtr): OSErr; external name '_ForEachIconDo';
  522. {
  523. * GetIconSuite()
  524. *
  525. * Availability:
  526. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  527. * CarbonLib: in CarbonLib 1.0 and later
  528. * Mac OS X: in version 10.0 and later
  529. }
  530. function GetIconSuite(var theIconSuite: IconSuiteRef; theResID: SInt16; selector: IconSelectorValue): OSErr; external name '_GetIconSuite';
  531. {
  532. * DisposeIconSuite()
  533. *
  534. * Availability:
  535. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  536. * CarbonLib: in CarbonLib 1.0 and later
  537. * Mac OS X: in version 10.0 and later
  538. }
  539. function DisposeIconSuite(theIconSuite: IconSuiteRef; disposeData: boolean): OSErr; external name '_DisposeIconSuite';
  540. {
  541. * PlotIconSuite()
  542. *
  543. * Availability:
  544. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  545. * CarbonLib: in CarbonLib 1.0 and later
  546. * Mac OS X: in version 10.0 and later
  547. }
  548. function PlotIconSuite(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconSuite: IconSuiteRef): OSErr; external name '_PlotIconSuite';
  549. {
  550. * MakeIconCache()
  551. *
  552. * Availability:
  553. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  554. * CarbonLib: in CarbonLib 1.0 and later
  555. * Mac OS X: in version 10.0 and later
  556. }
  557. function MakeIconCache(var theCache: IconCacheRef; makeIcon: IconGetterUPP; yourDataPtr: UnivPtr): OSErr; external name '_MakeIconCache';
  558. {
  559. * LoadIconCache()
  560. *
  561. * Availability:
  562. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  563. * CarbonLib: in CarbonLib 1.0 and later
  564. * Mac OS X: in version 10.0 and later
  565. }
  566. function LoadIconCache(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconCache: IconCacheRef): OSErr; external name '_LoadIconCache';
  567. {
  568. * PlotIconMethod()
  569. *
  570. * Availability:
  571. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  572. * CarbonLib: in CarbonLib 1.0 and later
  573. * Mac OS X: in version 10.0 and later
  574. }
  575. function PlotIconMethod(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): OSErr; external name '_PlotIconMethod';
  576. {
  577. * GetLabel()
  578. *
  579. * Availability:
  580. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  581. * CarbonLib: in CarbonLib 1.0 and later
  582. * Mac OS X: in version 10.0 and later
  583. }
  584. function GetLabel(labelNumber: SInt16; var labelColor: RGBColor; var labelString: Str255): OSErr; external name '_GetLabel';
  585. {
  586. * PtInIconID()
  587. *
  588. * Availability:
  589. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  590. * CarbonLib: in CarbonLib 1.0 and later
  591. * Mac OS X: in version 10.0 and later
  592. }
  593. function PtInIconID(testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; iconID: SInt16): boolean; external name '_PtInIconID';
  594. {
  595. * PtInIconSuite()
  596. *
  597. * Availability:
  598. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  599. * CarbonLib: in CarbonLib 1.0 and later
  600. * Mac OS X: in version 10.0 and later
  601. }
  602. function PtInIconSuite(testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): boolean; external name '_PtInIconSuite';
  603. {
  604. * PtInIconMethod()
  605. *
  606. * Availability:
  607. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  608. * CarbonLib: in CarbonLib 1.0 and later
  609. * Mac OS X: in version 10.0 and later
  610. }
  611. function PtInIconMethod(testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): boolean; external name '_PtInIconMethod';
  612. {
  613. * RectInIconID()
  614. *
  615. * Availability:
  616. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  617. * CarbonLib: in CarbonLib 1.0 and later
  618. * Mac OS X: in version 10.0 and later
  619. }
  620. function RectInIconID(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; iconID: SInt16): boolean; external name '_RectInIconID';
  621. {
  622. * RectInIconSuite()
  623. *
  624. * Availability:
  625. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  626. * CarbonLib: in CarbonLib 1.0 and later
  627. * Mac OS X: in version 10.0 and later
  628. }
  629. function RectInIconSuite(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): boolean; external name '_RectInIconSuite';
  630. {
  631. * RectInIconMethod()
  632. *
  633. * Availability:
  634. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  635. * CarbonLib: in CarbonLib 1.0 and later
  636. * Mac OS X: in version 10.0 and later
  637. }
  638. function RectInIconMethod(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): boolean; external name '_RectInIconMethod';
  639. {
  640. * IconIDToRgn()
  641. *
  642. * Availability:
  643. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  644. * CarbonLib: in CarbonLib 1.0 and later
  645. * Mac OS X: in version 10.0 and later
  646. }
  647. function IconIDToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; iconID: SInt16): OSErr; external name '_IconIDToRgn';
  648. {
  649. * IconSuiteToRgn()
  650. *
  651. * Availability:
  652. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  653. * CarbonLib: in CarbonLib 1.0 and later
  654. * Mac OS X: in version 10.0 and later
  655. }
  656. function IconSuiteToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): OSErr; external name '_IconSuiteToRgn';
  657. {
  658. * IconMethodToRgn()
  659. *
  660. * Availability:
  661. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  662. * CarbonLib: in CarbonLib 1.0 and later
  663. * Mac OS X: in version 10.0 and later
  664. }
  665. function IconMethodToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): OSErr; external name '_IconMethodToRgn';
  666. {
  667. * SetSuiteLabel()
  668. *
  669. * Availability:
  670. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  671. * CarbonLib: in CarbonLib 1.0 and later
  672. * Mac OS X: in version 10.0 and later
  673. }
  674. function SetSuiteLabel(theSuite: IconSuiteRef; theLabel: SInt16): OSErr; external name '_SetSuiteLabel';
  675. {
  676. * GetSuiteLabel()
  677. *
  678. * Availability:
  679. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  680. * CarbonLib: in CarbonLib 1.0 and later
  681. * Mac OS X: in version 10.0 and later
  682. }
  683. function GetSuiteLabel(theSuite: IconSuiteRef): SInt16; external name '_GetSuiteLabel';
  684. {
  685. * GetIconCacheData()
  686. *
  687. * Availability:
  688. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  689. * CarbonLib: in CarbonLib 1.0 and later
  690. * Mac OS X: in version 10.0 and later
  691. }
  692. function GetIconCacheData(theCache: IconCacheRef; var theData: UnivPtr): OSErr; external name '_GetIconCacheData';
  693. {
  694. * SetIconCacheData()
  695. *
  696. * Availability:
  697. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  698. * CarbonLib: in CarbonLib 1.0 and later
  699. * Mac OS X: in version 10.0 and later
  700. }
  701. function SetIconCacheData(theCache: IconCacheRef; theData: UnivPtr): OSErr; external name '_SetIconCacheData';
  702. {
  703. * GetIconCacheProc()
  704. *
  705. * Availability:
  706. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  707. * CarbonLib: in CarbonLib 1.0 and later
  708. * Mac OS X: in version 10.0 and later
  709. }
  710. function GetIconCacheProc(theCache: IconCacheRef; var theProc: IconGetterUPP): OSErr; external name '_GetIconCacheProc';
  711. {
  712. * SetIconCacheProc()
  713. *
  714. * Availability:
  715. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  716. * CarbonLib: in CarbonLib 1.0 and later
  717. * Mac OS X: in version 10.0 and later
  718. }
  719. function SetIconCacheProc(theCache: IconCacheRef; theProc: IconGetterUPP): OSErr; external name '_SetIconCacheProc';
  720. {
  721. * PlotIconHandle()
  722. *
  723. * Availability:
  724. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  725. * CarbonLib: in CarbonLib 1.0 and later
  726. * Mac OS X: in version 10.0 and later
  727. }
  728. function PlotIconHandle(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIcon: Handle): OSErr; external name '_PlotIconHandle';
  729. {
  730. * PlotSICNHandle()
  731. *
  732. * Availability:
  733. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  734. * CarbonLib: in CarbonLib 1.0 and later
  735. * Mac OS X: in version 10.0 and later
  736. }
  737. function PlotSICNHandle(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theSICN: Handle): OSErr; external name '_PlotSICNHandle';
  738. {
  739. * PlotCIconHandle()
  740. *
  741. * Availability:
  742. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  743. * CarbonLib: in CarbonLib 1.0 and later
  744. * Mac OS X: in version 10.0 and later
  745. }
  746. function PlotCIconHandle(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theCIcon: CIconHandle): OSErr; external name '_PlotCIconHandle';
  747. {
  748. IconServices is an efficient mechanism to share icon data amongst multiple
  749. clients. It avoids duplication of data; it provides efficient caching,
  750. releasing memory when the icon data is no longer needed; it can provide
  751. the appropriate icon for any filesystem object; it can provide commonly
  752. used icons (caution, note, help...); it is Appearance-savvy: the icons
  753. are switched when appropriate.
  754. IconServices refer to cached icon data using IconRef, a 32-bit opaque
  755. value. IconRefs are reference counted. When there are no more "owners"
  756. of an IconRef, the memory used by the icon bitmap is disposed of.
  757. Two files of same type and creator with no custom icon will have the same IconRef.
  758. Files with custom icons will have their own IconRef.
  759. }
  760. {
  761. Use the special creator kSystemIconsCreator to get "standard" icons
  762. that are not associated with a file, such as the help icon.
  763. Note that all lowercase creators are reserved by Apple.
  764. }
  765. const
  766. kSystemIconsCreator = $6D616373 (* 'macs' *);
  767. {
  768. Type of the predefined/generic icons. For example, the call:
  769. err = GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &iconRef);
  770. will retun in iconRef the IconRef for the standard help icon.
  771. }
  772. { Generic Finder icons }
  773. kClipboardIcon = $434C4950 (* 'CLIP' *);
  774. kClippingUnknownTypeIcon = $636C7075 (* 'clpu' *);
  775. kClippingPictureTypeIcon = $636C7070 (* 'clpp' *);
  776. kClippingTextTypeIcon = $636C7074 (* 'clpt' *);
  777. kClippingSoundTypeIcon = $636C7073 (* 'clps' *);
  778. kDesktopIcon = $6465736B (* 'desk' *);
  779. kFinderIcon = $464E4452 (* 'FNDR' *);
  780. kComputerIcon = $726F6F74 (* 'root' *);
  781. kFontSuitcaseIcon = $4646494C (* 'FFIL' *);
  782. kFullTrashIcon = $66747268 (* 'ftrh' *);
  783. kGenericApplicationIcon = $4150504C (* 'APPL' *);
  784. kGenericCDROMIcon = $63646472 (* 'cddr' *);
  785. kGenericControlPanelIcon = $41505043 (* 'APPC' *);
  786. kGenericControlStripModuleIcon = $73646576 (* 'sdev' *);
  787. kGenericComponentIcon = $74686E67 (* 'thng' *);
  788. kGenericDeskAccessoryIcon = $41505044 (* 'APPD' *);
  789. kGenericDocumentIcon = $646F6375 (* 'docu' *);
  790. kGenericEditionFileIcon = $65647466 (* 'edtf' *);
  791. kGenericExtensionIcon = $494E4954 (* 'INIT' *);
  792. kGenericFileServerIcon = $73727672 (* 'srvr' *);
  793. kGenericFontIcon = $6666696C (* 'ffil' *);
  794. kGenericFontScalerIcon = $73636C72 (* 'sclr' *);
  795. kGenericFloppyIcon = $666C7079 (* 'flpy' *);
  796. kGenericHardDiskIcon = $6864736B (* 'hdsk' *);
  797. kGenericIDiskIcon = $6964736B (* 'idsk' *);
  798. kGenericRemovableMediaIcon = $726D6F76 (* 'rmov' *);
  799. kGenericMoverObjectIcon = $6D6F7672 (* 'movr' *);
  800. kGenericPCCardIcon = $70636D63 (* 'pcmc' *);
  801. kGenericPreferencesIcon = $70726566 (* 'pref' *);
  802. kGenericQueryDocumentIcon = $71657279 (* 'qery' *);
  803. kGenericRAMDiskIcon = $72616D64 (* 'ramd' *);
  804. kGenericSharedLibaryIcon = $73686C62 (* 'shlb' *);
  805. kGenericStationeryIcon = $73646F63 (* 'sdoc' *);
  806. kGenericSuitcaseIcon = $73756974 (* 'suit' *);
  807. kGenericURLIcon = $6775726C (* 'gurl' *);
  808. kGenericWORMIcon = $776F726D (* 'worm' *);
  809. kInternationalResourcesIcon = $6966696C (* 'ifil' *);
  810. kKeyboardLayoutIcon = $6B66696C (* 'kfil' *);
  811. kSoundFileIcon = $7366696C (* 'sfil' *);
  812. kSystemSuitcaseIcon = $7A737973 (* 'zsys' *);
  813. kTrashIcon = $74727368 (* 'trsh' *);
  814. kTrueTypeFontIcon = $7466696C (* 'tfil' *);
  815. kTrueTypeFlatFontIcon = $73666E74 (* 'sfnt' *);
  816. kTrueTypeMultiFlatFontIcon = $74746366 (* 'ttcf' *);
  817. kUserIDiskIcon = $7564736B (* 'udsk' *);
  818. kUnknownFSObjectIcon = $756E6673 (* 'unfs' *);
  819. kInternationResourcesIcon = $6966696C (* 'ifil' *); { old misspelling }
  820. { Internet locations }
  821. kInternetLocationHTTPIcon = $696C6874 (* 'ilht' *);
  822. kInternetLocationFTPIcon = $696C6674 (* 'ilft' *);
  823. kInternetLocationAppleShareIcon = $696C6166 (* 'ilaf' *);
  824. kInternetLocationAppleTalkZoneIcon = $696C6174 (* 'ilat' *);
  825. kInternetLocationFileIcon = $696C6669 (* 'ilfi' *);
  826. kInternetLocationMailIcon = $696C6D61 (* 'ilma' *);
  827. kInternetLocationNewsIcon = $696C6E77 (* 'ilnw' *);
  828. kInternetLocationNSLNeighborhoodIcon = $696C6E73 (* 'ilns' *);
  829. kInternetLocationGenericIcon = $696C6765 (* 'ilge' *);
  830. { Folders }
  831. kGenericFolderIcon = $666C6472 (* 'fldr' *);
  832. kDropFolderIcon = $64626F78 (* 'dbox' *);
  833. kMountedFolderIcon = $6D6E7464 (* 'mntd' *);
  834. kOpenFolderIcon = $6F666C64 (* 'ofld' *);
  835. kOwnedFolderIcon = $6F776E64 (* 'ownd' *);
  836. kPrivateFolderIcon = $70727666 (* 'prvf' *);
  837. kSharedFolderIcon = $7368666C (* 'shfl' *);
  838. { Sharing Privileges icons }
  839. kSharingPrivsNotApplicableIcon = $73686E61 (* 'shna' *);
  840. kSharingPrivsReadOnlyIcon = $7368726F (* 'shro' *);
  841. kSharingPrivsReadWriteIcon = $73687277 (* 'shrw' *);
  842. kSharingPrivsUnknownIcon = $7368756B (* 'shuk' *);
  843. kSharingPrivsWritableIcon = $77726974 (* 'writ' *);
  844. { Users and Groups icons }
  845. kUserFolderIcon = $75666C64 (* 'ufld' *);
  846. kWorkgroupFolderIcon = $77666C64 (* 'wfld' *);
  847. kGuestUserIcon = $67757372 (* 'gusr' *);
  848. kUserIcon = $75736572 (* 'user' *);
  849. kOwnerIcon = $73757372 (* 'susr' *);
  850. kGroupIcon = $67727570 (* 'grup' *);
  851. { Special folders }
  852. kAppearanceFolderIcon = $61707072 (* 'appr' *);
  853. kAppleExtrasFolderIcon = $616578C6 (* 'aexÄ' *);
  854. kAppleMenuFolderIcon = $616D6E75 (* 'amnu' *);
  855. kApplicationsFolderIcon = $61707073 (* 'apps' *);
  856. kApplicationSupportFolderIcon = $61737570 (* 'asup' *);
  857. kAssistantsFolderIcon = $617374C6 (* 'astÄ' *);
  858. kColorSyncFolderIcon = $70726F66 (* 'prof' *);
  859. kContextualMenuItemsFolderIcon = $636D6E75 (* 'cmnu' *);
  860. kControlPanelDisabledFolderIcon = $63747244 (* 'ctrD' *);
  861. kControlPanelFolderIcon = $6374726C (* 'ctrl' *);
  862. kControlStripModulesFolderIcon = $736476C6 (* 'sdvÄ' *);
  863. kDocumentsFolderIcon = $646F6373 (* 'docs' *);
  864. kExtensionsDisabledFolderIcon = $65787444 (* 'extD' *);
  865. kExtensionsFolderIcon = $6578746E (* 'extn' *);
  866. kFavoritesFolderIcon = $66617673 (* 'favs' *);
  867. kFontsFolderIcon = $666F6E74 (* 'font' *);
  868. kHelpFolderIcon = $C692686C (* 'Ählp' *);
  869. kInternetFolderIcon = $696E74C6 (* 'intÄ' *);
  870. kInternetPlugInFolderIcon = $C6926E65 (* 'Änet' *);
  871. kInternetSearchSitesFolderIcon = $69737366 (* 'issf' *);
  872. kLocalesFolderIcon = $C6926C6F (* 'Äloc' *);
  873. kMacOSReadMeFolderIcon = $6D6F72C6 (* 'morÄ' *);
  874. kPublicFolderIcon = $70756266 (* 'pubf' *);
  875. kPreferencesFolderIcon = $707266C6 (* 'prfÄ' *);
  876. kPrinterDescriptionFolderIcon = $70706466 (* 'ppdf' *);
  877. kPrinterDriverFolderIcon = $C6927072 (* 'Äprd' *);
  878. kPrintMonitorFolderIcon = $70726E74 (* 'prnt' *);
  879. kRecentApplicationsFolderIcon = $72617070 (* 'rapp' *);
  880. kRecentDocumentsFolderIcon = $72646F63 (* 'rdoc' *);
  881. kRecentServersFolderIcon = $72737276 (* 'rsrv' *);
  882. kScriptingAdditionsFolderIcon = $C6927363 (* 'Äscr' *);
  883. kSharedLibrariesFolderIcon = $C6926C69 (* 'Älib' *);
  884. kScriptsFolderIcon = $736372C6 (* 'scrÄ' *);
  885. kShutdownItemsDisabledFolderIcon = $73686444 (* 'shdD' *);
  886. kShutdownItemsFolderIcon = $73686466 (* 'shdf' *);
  887. kSpeakableItemsFolder = $73706B69 (* 'spki' *);
  888. kStartupItemsDisabledFolderIcon = $73747244 (* 'strD' *);
  889. kStartupItemsFolderIcon = $73747274 (* 'strt' *);
  890. kSystemExtensionDisabledFolderIcon = $6D616344 (* 'macD' *);
  891. kSystemFolderIcon = $6D616373 (* 'macs' *);
  892. kTextEncodingsFolderIcon = $C6927465 (* 'Ätex' *);
  893. kUsersFolderIcon = $757372C6 (* 'usrÄ' *);
  894. kUtilitiesFolderIcon = $757469C6 (* 'utiÄ' *);
  895. kVoicesFolderIcon = $66766F63 (* 'fvoc' *);
  896. kSystemFolderXIcon = $6D616378 (* 'macx' *);
  897. { Badges }
  898. kAppleScriptBadgeIcon = $73637270 (* 'scrp' *);
  899. kLockedBadgeIcon = $6C626467 (* 'lbdg' *);
  900. kMountedBadgeIcon = $6D626467 (* 'mbdg' *);
  901. kSharedBadgeIcon = $73626467 (* 'sbdg' *);
  902. kAliasBadgeIcon = $61626467 (* 'abdg' *);
  903. kAlertCautionBadgeIcon = $63626467 (* 'cbdg' *);
  904. { Alert icons }
  905. kAlertNoteIcon = $6E6F7465 (* 'note' *);
  906. kAlertCautionIcon = $63617574 (* 'caut' *);
  907. kAlertStopIcon = $73746F70 (* 'stop' *);
  908. { Networking icons }
  909. kAppleTalkIcon = $61746C6B (* 'atlk' *);
  910. kAppleTalkZoneIcon = $61747A6E (* 'atzn' *);
  911. kAFPServerIcon = $61667073 (* 'afps' *);
  912. kFTPServerIcon = $66747073 (* 'ftps' *);
  913. kHTTPServerIcon = $68747073 (* 'htps' *);
  914. kGenericNetworkIcon = $676E6574 (* 'gnet' *);
  915. kIPFileServerIcon = $69737276 (* 'isrv' *);
  916. { Toolbar icons }
  917. kToolbarCustomizeIcon = $74637573 (* 'tcus' *);
  918. kToolbarDeleteIcon = $7464656C (* 'tdel' *);
  919. kToolbarFavoritesIcon = $74666176 (* 'tfav' *);
  920. kToolbarHomeIcon = $74686F6D (* 'thom' *);
  921. { Other icons }
  922. kAppleLogoIcon = $6361706C (* 'capl' *);
  923. kAppleMenuIcon = $7361706C (* 'sapl' *);
  924. kBackwardArrowIcon = $6261726F (* 'baro' *);
  925. kFavoriteItemsIcon = $66617672 (* 'favr' *);
  926. kForwardArrowIcon = $6661726F (* 'faro' *);
  927. kGridIcon = $67726964 (* 'grid' *);
  928. kHelpIcon = $68656C70 (* 'help' *);
  929. kKeepArrangedIcon = $61726E67 (* 'arng' *);
  930. kLockedIcon = $6C6F636B (* 'lock' *);
  931. kNoFilesIcon = $6E66696C (* 'nfil' *);
  932. kNoFolderIcon = $6E666C64 (* 'nfld' *);
  933. kNoWriteIcon = $6E777274 (* 'nwrt' *);
  934. kProtectedApplicationFolderIcon = $70617070 (* 'papp' *);
  935. kProtectedSystemFolderIcon = $70737973 (* 'psys' *);
  936. kRecentItemsIcon = $72636E74 (* 'rcnt' *);
  937. kShortcutIcon = $73687274 (* 'shrt' *);
  938. kSortAscendingIcon = $61736E64 (* 'asnd' *);
  939. kSortDescendingIcon = $64736E64 (* 'dsnd' *);
  940. kUnlockedIcon = $756C636B (* 'ulck' *);
  941. kConnectToIcon = $636E6374 (* 'cnct' *);
  942. kGenericWindowIcon = $6777696E (* 'gwin' *);
  943. kQuestionMarkIcon = $71756573 (* 'ques' *);
  944. kDeleteAliasIcon = $64616C69 (* 'dali' *);
  945. kEjectMediaIcon = $656A6563 (* 'ejec' *);
  946. kBurningIcon = $6275726E (* 'burn' *);
  947. kRightContainerArrowIcon = $72636172 (* 'rcar' *);
  948. { IconServicesUsageFlags }
  949. type
  950. IconServicesUsageFlags = UInt32;
  951. const
  952. kIconServicesNormalUsageFlag = $00000000;
  953. kIconServicesNoBadgeFlag = $00000001; // available on Panther and later
  954. kIconServicesUpdateIfNeededFlag = $00000002; // available on Panther and later
  955. {
  956. kIconServicesCatalogInfoMask - Minimal bitmask for use with
  957. GetIconRefFromFileInfo(). Use this mask with FSGetCatalogInfo
  958. before calling GetIconRefFromFileInfo().
  959. }
  960. kIconServicesCatalogInfoMask = $0008181E;
  961. {
  962. * PlotIconRefFlags
  963. *
  964. * Discussion:
  965. * Flags that can be passed to the PlotIconRefInContext routine.
  966. }
  967. type
  968. PlotIconRefFlags = UInt32;
  969. const
  970. kPlotIconRefNormalFlags = 0;
  971. kPlotIconRefNoImage = $02;
  972. kPlotIconRefNoMask = $04;
  973. {
  974. IconFamily 'icns' resources contain an entire IconFamily (all sizes and depths).
  975. For custom icons, icns IconFamily resources of the custom icon resource ID are fetched first before
  976. the classic custom icons (individual 'ics#, ICN#, etc) are fetched. If the fetch of the icns resource
  977. succeeds then the icns is looked at exclusively for the icon data.
  978. For custom icons, new icon features such as 32-bit deep icons are only fetched from the icns resource.
  979. This is to avoid incompatibilities with cut & paste of new style icons with an older version of the
  980. MacOS Finder.
  981. DriverGestalt is called with code kdgMediaIconSuite by IconServices after calling FSM to determine a
  982. driver icon for a particular device. The result of the kdgMediaIconSuite call to DriverGestalt should
  983. be a pointer an an IconFamily. In this manner driver vendors can provide rich, detailed drive icons
  984. instead of the 1-bit variety previously supported.
  985. }
  986. kIconFamilyType = $69636E73 (* 'icns' *);
  987. type
  988. IconFamilyElementPtr = ^IconFamilyElement;
  989. IconFamilyElement = record
  990. elementType: OSType; { 'ICN#', 'icl8', etc... }
  991. elementSize: Size; { Size of this element }
  992. elementData: SInt8;
  993. end;
  994. IconFamilyResourcePtr = ^IconFamilyResource;
  995. IconFamilyResource = record
  996. resourceType: OSType; { Always 'icns' }
  997. resourceSize: Size; { Total size of this resource }
  998. elements: array [0..0] of IconFamilyElement;
  999. end;
  1000. IconFamilyPtr = ^IconFamilyResource;
  1001. IconFamilyHandle = ^IconFamilyPtr;
  1002. {
  1003. ==============================================================================
  1004. Initialization and Termination
  1005. ==============================================================================
  1006. }
  1007. {
  1008. IconServicesInit
  1009. Call this routine once per classic 68K application initialization.
  1010. This routine does not need to be called at boot time.
  1011. }
  1012. {$ifc CALL_NOT_IN_CARBON}
  1013. {
  1014. * IconServicesInit()
  1015. *
  1016. * Availability:
  1017. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1018. * CarbonLib: not available
  1019. * Mac OS X: not available
  1020. }
  1021. function IconServicesInit(initBlockPtr: CFragInitBlockPtr): OSErr; external name '_IconServicesInit';
  1022. {
  1023. IconServicesTerminate:
  1024. Call this routine once from the termination of a classic 68K application.
  1025. This routine does not need to be called at boot time.
  1026. }
  1027. {
  1028. * IconServicesTerminate()
  1029. *
  1030. * Availability:
  1031. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1032. * CarbonLib: not available
  1033. * Mac OS X: not available
  1034. }
  1035. procedure IconServicesTerminate; external name '_IconServicesTerminate';
  1036. {$endc} {CALL_NOT_IN_CARBON}
  1037. {
  1038. ==============================================================================
  1039. Converting data structures
  1040. ==============================================================================
  1041. }
  1042. {
  1043. IconRefToIconFamily
  1044. This routines returns a new IconFamily that contains the data corresponding
  1045. to the specified IconRef.
  1046. }
  1047. {
  1048. * IconRefToIconFamily()
  1049. *
  1050. * Availability:
  1051. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1052. * CarbonLib: in CarbonLib 1.0 and later
  1053. * Mac OS X: in version 10.0 and later
  1054. }
  1055. function IconRefToIconFamily(theIconRef: IconRef; whichIcons: IconSelectorValue; var iconFamily: IconFamilyHandle): OSErr; external name '_IconRefToIconFamily';
  1056. {
  1057. IconFamilyToIconSuite
  1058. This routine transfers the data from an icon family handle into an icon suite.
  1059. }
  1060. {
  1061. * IconFamilyToIconSuite()
  1062. *
  1063. * Availability:
  1064. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1065. * CarbonLib: in CarbonLib 1.0 and later
  1066. * Mac OS X: in version 10.0 and later
  1067. }
  1068. function IconFamilyToIconSuite(iconFamily: IconFamilyHandle; whichIcons: IconSelectorValue; var iconSuite: IconSuiteRef): OSErr; external name '_IconFamilyToIconSuite';
  1069. {
  1070. IconSuiteToIconFamily
  1071. This routine transfers the data in an icon suite into an icon family.
  1072. }
  1073. {
  1074. * IconSuiteToIconFamily()
  1075. *
  1076. * Availability:
  1077. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1078. * CarbonLib: in CarbonLib 1.0 and later
  1079. * Mac OS X: in version 10.0 and later
  1080. }
  1081. function IconSuiteToIconFamily(iconSuite: IconSuiteRef; whichIcons: IconSelectorValue; var iconFamily: IconFamilyHandle): OSErr; external name '_IconSuiteToIconFamily';
  1082. {
  1083. SetIconFamilyData
  1084. Change the data of an icon family. The data is copied.
  1085. The type can be one of the icon type, or 'PICT'.
  1086. The data will be compressed if needed.
  1087. }
  1088. {
  1089. * SetIconFamilyData()
  1090. *
  1091. * Availability:
  1092. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1093. * CarbonLib: in CarbonLib 1.0 and later
  1094. * Mac OS X: in version 10.0 and later
  1095. }
  1096. function SetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr; external name '_SetIconFamilyData';
  1097. {
  1098. GetIconFamilyData
  1099. Return a copy of the data in the icon family.
  1100. The type can be one of the icon type, or 'PICT'
  1101. The data will be returned uncompressed.
  1102. The handle (h) will be resized as appropriate. If no data of the
  1103. requested type is present, the handle size will be set to 0.
  1104. }
  1105. {
  1106. * GetIconFamilyData()
  1107. *
  1108. * Availability:
  1109. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1110. * CarbonLib: in CarbonLib 1.0 and later
  1111. * Mac OS X: in version 10.0 and later
  1112. }
  1113. function GetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr; external name '_GetIconFamilyData';
  1114. {
  1115. ==============================================================================
  1116. Reference counting
  1117. ==============================================================================
  1118. }
  1119. {
  1120. GetIconRefOwners
  1121. This routine returns the reference count for the IconRef, or number of owners.
  1122. A valid IconRef always has at least one owner.
  1123. }
  1124. {
  1125. * GetIconRefOwners()
  1126. *
  1127. * Availability:
  1128. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1129. * CarbonLib: in CarbonLib 1.0 and later
  1130. * Mac OS X: in version 10.0 and later
  1131. }
  1132. function GetIconRefOwners(theIconRef: IconRef; var owners: UInt16): OSErr; external name '_GetIconRefOwners';
  1133. {
  1134. AcquireIconRef
  1135. This routine increments the reference count for the IconRef
  1136. }
  1137. {
  1138. * AcquireIconRef()
  1139. *
  1140. * Availability:
  1141. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1142. * CarbonLib: in CarbonLib 1.0 and later
  1143. * Mac OS X: in version 10.0 and later
  1144. }
  1145. function AcquireIconRef(theIconRef: IconRef): OSErr; external name '_AcquireIconRef';
  1146. {
  1147. ReleaseIconRef
  1148. This routine decrements the reference count for the IconRef.
  1149. When the reference count reaches 0, all memory allocated for the icon
  1150. is disposed. Any subsequent use of the IconRef is invalid.
  1151. }
  1152. {
  1153. * ReleaseIconRef()
  1154. *
  1155. * Availability:
  1156. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1157. * CarbonLib: in CarbonLib 1.0 and later
  1158. * Mac OS X: in version 10.0 and later
  1159. }
  1160. function ReleaseIconRef(theIconRef: IconRef): OSErr; external name '_ReleaseIconRef';
  1161. {
  1162. ==============================================================================
  1163. Getting an IconRef
  1164. ==============================================================================
  1165. }
  1166. {
  1167. GetIconRefFromFile
  1168. This routine returns an icon ref for the specified file, folder or volume.
  1169. The label information is provided separately, since two files with the same icon
  1170. but a different label would share the same iconRef. The label can be used in
  1171. PlotIconRef() for example.
  1172. Use this routine if you have no information about the file system object. If
  1173. you have already done a GetCatInfo on the file and want to save some I/O,
  1174. call GetIconRefFromFolder() if you know it's a folder with no custom icon or
  1175. call GetIconRef() if it's a file with no custom icon.
  1176. This routine increments the reference count of the returned IconRef. Call
  1177. ReleaseIconRef() when you're done with it.
  1178. }
  1179. {
  1180. * GetIconRefFromFile()
  1181. *
  1182. * Availability:
  1183. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1184. * CarbonLib: in CarbonLib 1.0 and later
  1185. * Mac OS X: in version 10.0 and later
  1186. }
  1187. function GetIconRefFromFile(const (*var*) theFile: FSSpec; var theIconRef: IconRef; var theLabel: SInt16): OSErr; external name '_GetIconRefFromFile';
  1188. {
  1189. GetIconRef
  1190. This routine returns an icon ref for an icon in the desktop database or
  1191. for a registered icon.
  1192. The system registers a set of icon such as the help icon with the creator
  1193. code kSystemIconsCreator. See above for a list of the registered system types.
  1194. The vRefNum is used as a hint on where to look for the icon first. Use
  1195. kOnSystemDisk if you don't know what to pass.
  1196. This routine increments the reference count of the returned IconRef. Call
  1197. ReleaseIconRef() when you're done with it.
  1198. }
  1199. {
  1200. * GetIconRef()
  1201. *
  1202. * Availability:
  1203. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1204. * CarbonLib: in CarbonLib 1.0 and later
  1205. * Mac OS X: in version 10.0 and later
  1206. }
  1207. function GetIconRef(vRefNum: SInt16; creator: OSType; iconType: OSType; var theIconRef: IconRef): OSErr; external name '_GetIconRef';
  1208. {
  1209. GetIconRefFromFolder
  1210. This routine returns an icon ref for a folder with no custom icon.
  1211. Use the more generic, but slightly slower, GetIconRefFromFile() if
  1212. you don't already have the necessary info about the file.
  1213. Attributes should be CInfoPBRec.dirInfo.ioFlAttrib for this folder.
  1214. Access privileges should be CInfoPBRec.dirInfo.ioACUser for this folder.
  1215. This routine increments the reference count of the IconRef. Call ReleaseIconRef()
  1216. when you're done with it.
  1217. }
  1218. {
  1219. * GetIconRefFromFolder()
  1220. *
  1221. * Availability:
  1222. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1223. * CarbonLib: in CarbonLib 1.0 and later
  1224. * Mac OS X: in version 10.0 and later
  1225. }
  1226. function GetIconRefFromFolder(vRefNum: SInt16; parentFolderID: SInt32; folderID: SInt32; attributes: SInt8; accessPrivileges: SInt8; var theIconRef: IconRef): OSErr; external name '_GetIconRefFromFolder';
  1227. { GetIconRefFromFileInfo }
  1228. {
  1229. * GetIconRefFromFileInfo()
  1230. *
  1231. * Summary:
  1232. * This routine returns an IconRef for a file with minimal file I/O.
  1233. *
  1234. * Discussion:
  1235. * To minimize file operations, FSGetCatalogInfo should be called
  1236. * prior to calling this routine. The FSCatalogInfo should
  1237. * correspond to kIconServicesCatalogInfoMask The name should be
  1238. * fetched and passed in. If either the name or the correct catalog
  1239. * info is not passed in, this routine will do file operations for
  1240. * this information instead.
  1241. *
  1242. * Parameters:
  1243. *
  1244. * inRef:
  1245. * An FSRef for the target file
  1246. *
  1247. * inFileNameLength:
  1248. * The length of the name of the target file
  1249. *
  1250. * inFileName:
  1251. * The name of the target file
  1252. *
  1253. * inWhichInfo:
  1254. * The mask of file info already acquired.
  1255. *
  1256. * inCatalogInfo:
  1257. * The catalog info already acquired.
  1258. *
  1259. * inUsageFlags:
  1260. * The usage flags for this call (use
  1261. * kIconServicesNormalUsageFlag).
  1262. *
  1263. * outIconRef:
  1264. * The output IconRef for the routine.
  1265. *
  1266. * outLabel:
  1267. * The output label for the icon/file.
  1268. *
  1269. * Availability:
  1270. * Non-Carbon CFM: not available
  1271. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  1272. * Mac OS X: in version 10.1 and later
  1273. }
  1274. function GetIconRefFromFileInfo(const (*var*) inRef: FSRef; inFileNameLength: UniCharCount; inFileName: UniCharPtr; inWhichInfo: FSCatalogInfoBitmap; inCatalogInfo: {Const}FSCatalogInfoPtr; inUsageFlags: IconServicesUsageFlags; var outIconRef: IconRef; var outLabel: SInt16): OSStatus; external name '_GetIconRefFromFileInfo';
  1275. { GetIconRefFromTypeInfo}
  1276. {
  1277. * GetIconRefFromTypeInfo()
  1278. *
  1279. * Summary:
  1280. * Create an IconRef for a type information.
  1281. *
  1282. * Discussion:
  1283. * Creates IconRef based on provided type info. Any of the input
  1284. * parameters can be zero (meaning it is unknown). Returns generic
  1285. * document icon in case if all parameters are zeroes. Calling the
  1286. * routine with non zero inCreator and inType and zero inExtension
  1287. * and inMIMEType is equivalent to GetIconRef(kOnSystemDisk,
  1288. * inCreator, inType).
  1289. *
  1290. * Mac OS X threading:
  1291. * Not thread safe
  1292. *
  1293. * Parameters:
  1294. *
  1295. * inCreator:
  1296. * The creator.
  1297. *
  1298. * inType:
  1299. * The type.
  1300. *
  1301. * inExtension:
  1302. * The extension.
  1303. *
  1304. * inMIMEType:
  1305. * The MIME type.
  1306. *
  1307. * inUsageFlags:
  1308. * The usage flags for this call (use
  1309. * kIconServicesNormalUsageFlag).
  1310. *
  1311. * outIconRef:
  1312. * The output IconRef for the routine.
  1313. *
  1314. * Availability:
  1315. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  1316. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  1317. * Non-Carbon CFM: not available
  1318. }
  1319. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  1320. function GetIconRefFromTypeInfo( inCreator: OSType; inType: OSType; inExtension: CFStringRef; inMIMEType: CFStringRef; inUsageFlags: IconServicesUsageFlags; var outIconRef: IconRef ): OSErr; external name '_GetIconRefFromTypeInfo';
  1321. { GetIconRefFromIconFamilyPtr}
  1322. {
  1323. * GetIconRefFromIconFamilyPtr()
  1324. *
  1325. * Summary:
  1326. * Create an IconRef for the IconFamilyPtr.
  1327. *
  1328. * Discussion:
  1329. * This routine creates IconRef for the IconFamilyPtr.
  1330. *
  1331. * Mac OS X threading:
  1332. * Not thread safe
  1333. *
  1334. * Parameters:
  1335. *
  1336. * inIconFamilyPtr:
  1337. * The icon data
  1338. *
  1339. * inSize:
  1340. * The icon data size
  1341. *
  1342. * outIconRef:
  1343. * The output IconRef for the routine.
  1344. *
  1345. * Availability:
  1346. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  1347. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  1348. * Non-Carbon CFM: not available
  1349. }
  1350. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  1351. function GetIconRefFromIconFamilyPtr( const (*var*) inIconFamilyPtr: IconFamilyResource; inSize: Size; var outIconRef: IconRef ): OSStatus; external name '_GetIconRefFromIconFamilyPtr';
  1352. {
  1353. ==============================================================================
  1354. Adding and modifying IconRef
  1355. ==============================================================================
  1356. }
  1357. {
  1358. RegisterIconRefFromIconFamily
  1359. This routine adds a new entry to the IconRef registry. Other clients will be
  1360. able to access it using the (creator, iconType) pair specified here.
  1361. Lower-case creators are reserved for the system.
  1362. Consider using RegisterIconRefFromResource() if possible, since the data
  1363. registered using RegisterIconRefFromFamily() cannot be purged.
  1364. The iconFamily data is copied and the caller is reponsible for disposing of it.
  1365. This routine increments the reference count of the IconRef. Call ReleaseIconRef()
  1366. when you're done with it.
  1367. }
  1368. {
  1369. * RegisterIconRefFromIconFamily()
  1370. *
  1371. * Availability:
  1372. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1373. * CarbonLib: in CarbonLib 1.0 and later
  1374. * Mac OS X: in version 10.0 and later
  1375. }
  1376. function RegisterIconRefFromIconFamily(creator: OSType; iconType: OSType; iconFamily: IconFamilyHandle; var theIconRef: IconRef): OSErr; external name '_RegisterIconRefFromIconFamily';
  1377. {
  1378. RegisterIconRefFromResource
  1379. Registers an IconRef from a resouce file.
  1380. Lower-case creators are reserved for the system.
  1381. The icon data to be fetched is either classic icon data or an icon family.
  1382. The 'icns' icon family is searched for before the classic icon data.
  1383. This routine increments the reference count of the IconRef. Call ReleaseIconRef()
  1384. when you're done with it.
  1385. }
  1386. {
  1387. * RegisterIconRefFromResource()
  1388. *
  1389. * Availability:
  1390. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1391. * CarbonLib: in CarbonLib 1.0 and later
  1392. * Mac OS X: in version 10.0 and later
  1393. }
  1394. function RegisterIconRefFromResource(creator: OSType; iconType: OSType; const (*var*) resourceFile: FSSpec; resourceID: SInt16; var theIconRef: IconRef): OSErr; external name '_RegisterIconRefFromResource';
  1395. { RegisterIconRefFromFSRef }
  1396. {
  1397. * RegisterIconRefFromFSRef()
  1398. *
  1399. * Discussion:
  1400. * This routine registers an IconRef from a ".icns" file and
  1401. * associates it with a creator/type pair.
  1402. *
  1403. * Parameters:
  1404. *
  1405. * creator:
  1406. * The creator code for the icns file.
  1407. *
  1408. * iconType:
  1409. * The type code for the icns file
  1410. *
  1411. * iconFile:
  1412. * The FSRef of the icns file.
  1413. *
  1414. * theIconRef:
  1415. * The output IconRef for the routine.
  1416. *
  1417. * Availability:
  1418. * Non-Carbon CFM: not available
  1419. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  1420. * Mac OS X: in version 10.1 and later
  1421. }
  1422. function RegisterIconRefFromFSRef(creator: OSType; iconType: OSType; const (*var*) iconFile: FSRef; var theIconRef: IconRef): OSStatus; external name '_RegisterIconRefFromFSRef';
  1423. {
  1424. UnregisterIconRef
  1425. Removes the specified icon from the icon cache (if there are no users of it).
  1426. If some clients are using this iconRef, then the IconRef will be removed when the
  1427. last user calls ReleaseIconRef.
  1428. }
  1429. {
  1430. * UnregisterIconRef()
  1431. *
  1432. * Availability:
  1433. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1434. * CarbonLib: in CarbonLib 1.0 and later
  1435. * Mac OS X: in version 10.0 and later
  1436. }
  1437. function UnregisterIconRef(creator: OSType; iconType: OSType): OSErr; external name '_UnregisterIconRef';
  1438. {
  1439. UpdateIconRef
  1440. Call this routine to force an update of the data for iconRef.
  1441. For example after changing an icon in the desktop database or changing the custom
  1442. icon of a file. Note that after _adding_ a custom icon to file or folder, you
  1443. need to call GetIconRefFromFile() to get a new IconRef specific to this file.
  1444. This routine does nothing if the IconRef is a registered icon.
  1445. }
  1446. {
  1447. * UpdateIconRef()
  1448. *
  1449. * Availability:
  1450. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1451. * CarbonLib: in CarbonLib 1.0 and later
  1452. * Mac OS X: in version 10.0 and later
  1453. }
  1454. function UpdateIconRef(theIconRef: IconRef): OSErr; external name '_UpdateIconRef';
  1455. {
  1456. OverrideIconRefFromResource
  1457. This routines replaces the bitmaps of the specified IconRef with the ones
  1458. in the specified resource file.
  1459. }
  1460. {
  1461. * OverrideIconRefFromResource()
  1462. *
  1463. * Availability:
  1464. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1465. * CarbonLib: in CarbonLib 1.0 and later
  1466. * Mac OS X: in version 10.0 and later
  1467. }
  1468. function OverrideIconRefFromResource(theIconRef: IconRef; const (*var*) resourceFile: FSSpec; resourceID: SInt16): OSErr; external name '_OverrideIconRefFromResource';
  1469. {
  1470. OverrideIconRef
  1471. This routines replaces the bitmaps of the specified IconRef with the ones
  1472. from the new IconRef.
  1473. }
  1474. {
  1475. * OverrideIconRef()
  1476. *
  1477. * Availability:
  1478. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1479. * CarbonLib: in CarbonLib 1.0 and later
  1480. * Mac OS X: in version 10.0 and later
  1481. }
  1482. function OverrideIconRef(oldIconRef: IconRef; newIconRef: IconRef): OSErr; external name '_OverrideIconRef';
  1483. {
  1484. RemoveIconRefOverride
  1485. This routine remove an override if one was applied to the icon and
  1486. reverts back to the original bitmap data.
  1487. }
  1488. {
  1489. * RemoveIconRefOverride()
  1490. *
  1491. * Availability:
  1492. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1493. * CarbonLib: in CarbonLib 1.0 and later
  1494. * Mac OS X: in version 10.0 and later
  1495. }
  1496. function RemoveIconRefOverride(theIconRef: IconRef): OSErr; external name '_RemoveIconRefOverride';
  1497. {
  1498. ==============================================================================
  1499. Creating composite IconRef
  1500. ==============================================================================
  1501. }
  1502. {
  1503. CompositeIconRef
  1504. Superimposes an IconRef on top of another one
  1505. }
  1506. {
  1507. * CompositeIconRef()
  1508. *
  1509. * Availability:
  1510. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1511. * CarbonLib: in CarbonLib 1.0 and later
  1512. * Mac OS X: in version 10.0 and later
  1513. }
  1514. function CompositeIconRef(backgroundIconRef: IconRef; foregroundIconRef: IconRef; var compositeIconRef: IconRef): OSErr; external name '_CompositeIconRef';
  1515. {
  1516. IsIconRefComposite
  1517. Indicates if a given icon ref is a composite of two other icon refs (and which ones)
  1518. If it isn't a composite, backgroundIconRef and foreGroundIconRef will be 0.
  1519. }
  1520. {
  1521. * IsIconRefComposite()
  1522. *
  1523. * Availability:
  1524. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1525. * CarbonLib: in CarbonLib 1.0 and later
  1526. * Mac OS X: in version 10.0 and later
  1527. }
  1528. function IsIconRefComposite(compositeIconRef: IconRef; var backgroundIconRef: IconRef; var foregroundIconRef: IconRef): OSErr; external name '_IsIconRefComposite';
  1529. {
  1530. ==============================================================================
  1531. Using IconRef
  1532. ==============================================================================
  1533. }
  1534. {
  1535. IsValidIconRef
  1536. Return true if the iconRef passed in is a valid icon ref
  1537. }
  1538. {
  1539. * IsValidIconRef()
  1540. *
  1541. * Availability:
  1542. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1543. * CarbonLib: in CarbonLib 1.0 and later
  1544. * Mac OS X: in version 10.0 and later
  1545. }
  1546. function IsValidIconRef(theIconRef: IconRef): boolean; external name '_IsValidIconRef';
  1547. {
  1548. PlotIconRef
  1549. This routine plots the IconRef. It mostly takes the same parameters as
  1550. PlotIconSuite. Pass kIconServicesNormalUsageFlag as a default value for
  1551. IconServicesUsageFlags.
  1552. }
  1553. {
  1554. * PlotIconRef()
  1555. *
  1556. * Availability:
  1557. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1558. * CarbonLib: in CarbonLib 1.0 and later
  1559. * Mac OS X: in version 10.0 and later
  1560. }
  1561. function PlotIconRef(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr; external name '_PlotIconRef';
  1562. { PlotIconRefInContext }
  1563. {
  1564. * PlotIconRefInContext()
  1565. *
  1566. * Discussion:
  1567. * This routines plots an IconRef using Quartz/CoreGraphics.
  1568. *
  1569. * Parameters:
  1570. *
  1571. * inContext:
  1572. * The graphics context to use.
  1573. *
  1574. * inRect:
  1575. * The rect to plot the icon in.
  1576. *
  1577. * inAlign:
  1578. * The icon alignment.
  1579. *
  1580. * inTransform:
  1581. * The icon transform.
  1582. *
  1583. * inLabelColor:
  1584. * The icon label color.
  1585. *
  1586. * inFlags:
  1587. * The drawing flags to use (usually kPlotIconRefNormalFlags).
  1588. *
  1589. * inIconRef:
  1590. * The IconRef to plot.
  1591. *
  1592. * Availability:
  1593. * Non-Carbon CFM: not available
  1594. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  1595. * Mac OS X: in version 10.1 and later
  1596. }
  1597. function PlotIconRefInContext(inContext: CGContextRef; const (*var*) inRect: CGRect; inAlign: IconAlignmentType; inTransform: IconTransformType; inLabelColor: RGBColorPtr; inFlags: PlotIconRefFlags; inIconRef: IconRef): OSStatus; external name '_PlotIconRefInContext';
  1598. {
  1599. PtInIconRef
  1600. This routine indicates if testPt would hit the icon designated by iconRef.
  1601. It mostly takes the same parameters as PtInIconSuite.
  1602. Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1603. }
  1604. {
  1605. * PtInIconRef()
  1606. *
  1607. * Availability:
  1608. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1609. * CarbonLib: in CarbonLib 1.0 and later
  1610. * Mac OS X: in version 10.0 and later
  1611. }
  1612. function PtInIconRef(const (*var*) testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): boolean; external name '_PtInIconRef';
  1613. {
  1614. RectInIconRef
  1615. This routine indicates if testRect would intersect the icon designated by iconRef.
  1616. It mostly takes the same parameters as RectInIconSuite.
  1617. Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1618. }
  1619. {
  1620. * RectInIconRef()
  1621. *
  1622. * Availability:
  1623. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1624. * CarbonLib: in CarbonLib 1.0 and later
  1625. * Mac OS X: in version 10.0 and later
  1626. }
  1627. function RectInIconRef(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): boolean; external name '_RectInIconRef';
  1628. {
  1629. IconRefToRgn
  1630. This routine returns a region for the icon.
  1631. It mostly takes the same parameters as IconSuiteToRgn.
  1632. Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1633. }
  1634. {
  1635. * IconRefToRgn()
  1636. *
  1637. * Availability:
  1638. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1639. * CarbonLib: in CarbonLib 1.0 and later
  1640. * Mac OS X: in version 10.0 and later
  1641. }
  1642. function IconRefToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr; external name '_IconRefToRgn';
  1643. {
  1644. GetIconSizesFromIconRef
  1645. This routine returns an IconSelectorValue indicating the depths and sizes of
  1646. icon data which are actually available. It takes an IconSelectorValue
  1647. indicating which sizes/depths the caller is interested and returns an
  1648. IconSelectorValue indicating which sizes/depths exist.
  1649. Caution:
  1650. This is potentially an extremely expensive call as IconServices may be forced
  1651. to attempt fetching the data for the IconRef's sizes/depths which may result
  1652. in hitting the local disk or even the network to obtain the data to determine
  1653. which sizes/depths actually exist.
  1654. Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1655. }
  1656. {
  1657. * GetIconSizesFromIconRef()
  1658. *
  1659. * Availability:
  1660. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1661. * CarbonLib: in CarbonLib 1.0 and later
  1662. * Mac OS X: in version 10.0 and later
  1663. }
  1664. function GetIconSizesFromIconRef(iconSelectorInput: IconSelectorValue; var iconSelectorOutputPtr: IconSelectorValue; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr; external name '_GetIconSizesFromIconRef';
  1665. {
  1666. ==============================================================================
  1667. Flushing IconRef data
  1668. ==============================================================================
  1669. }
  1670. {
  1671. FlushIconRefs
  1672. Making this call will dispose of all the data for the specified icons if
  1673. the data can be reacquired, for example if the data is provided from a resource.
  1674. '****' is a wildcard for all types or all creators.
  1675. }
  1676. {
  1677. * FlushIconRefs()
  1678. *
  1679. * Availability:
  1680. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1681. * CarbonLib: in CarbonLib 1.0 and later
  1682. * Mac OS X: in version 10.0 and later
  1683. }
  1684. function FlushIconRefs(creator: OSType; iconType: OSType): OSErr; external name '_FlushIconRefs';
  1685. {
  1686. FlushIconRefsByVolume
  1687. This routine disposes of the data for the icons related to the indicated volume
  1688. if this data can be reacquired, for example if the data is provided from a
  1689. resource.
  1690. }
  1691. {
  1692. * FlushIconRefsByVolume()
  1693. *
  1694. * Availability:
  1695. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1696. * CarbonLib: in CarbonLib 1.0 and later
  1697. * Mac OS X: in version 10.0 and later
  1698. }
  1699. function FlushIconRefsByVolume(vRefNum: SInt16): OSErr; external name '_FlushIconRefsByVolume';
  1700. {
  1701. ==============================================================================
  1702. Controling custom icons
  1703. ==============================================================================
  1704. }
  1705. {
  1706. SetCustomIconsEnabled
  1707. Enable or disable custom icons on the specified volume.
  1708. }
  1709. {
  1710. * SetCustomIconsEnabled()
  1711. *
  1712. * Availability:
  1713. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1714. * CarbonLib: in CarbonLib 1.0 and later
  1715. * Mac OS X: in version 10.0 and later
  1716. }
  1717. function SetCustomIconsEnabled(vRefNum: SInt16; enableCustomIcons: boolean): OSErr; external name '_SetCustomIconsEnabled';
  1718. {
  1719. GetCustomIconsEnabled
  1720. Return true if custom icons are enabled on the specified volume, false otherwise.
  1721. }
  1722. {
  1723. * GetCustomIconsEnabled()
  1724. *
  1725. * Availability:
  1726. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1727. * CarbonLib: in CarbonLib 1.0 and later
  1728. * Mac OS X: in version 10.0 and later
  1729. }
  1730. function GetCustomIconsEnabled(vRefNum: SInt16; var customIconsEnabled: boolean): OSErr; external name '_GetCustomIconsEnabled';
  1731. {
  1732. IsIconRefMaskEmpty
  1733. Returns true if the mask for this icon is blank
  1734. }
  1735. {
  1736. * IsIconRefMaskEmpty()
  1737. *
  1738. * Availability:
  1739. * Non-Carbon CFM: in IconServicesLib 8.5 and later
  1740. * CarbonLib: in CarbonLib 1.0 and later
  1741. * Mac OS X: in version 10.0 and later
  1742. }
  1743. function IsIconRefMaskEmpty(iconRef: IconRef): boolean; external name '_IsIconRefMaskEmpty';
  1744. {
  1745. GetIconRefVariant
  1746. Icon variants allows different images to be used with different icon state.
  1747. For example, the 'open' variant for a folder could be represented with
  1748. an open folder.
  1749. Given an icon ref and a desired variant, this routine returns an icon
  1750. ref (which may be the same as the input icon ref) and a transformation
  1751. which should be used with PlotIconRef() to render the icon appropriately.
  1752. The returned icon ref should be used to do hit-testing.
  1753. }
  1754. {
  1755. * GetIconRefVariant()
  1756. *
  1757. * Availability:
  1758. * Non-Carbon CFM: in IconServicesLib 9.0 and later
  1759. * CarbonLib: in CarbonLib 1.0 and later
  1760. * Mac OS X: in version 10.0 and later
  1761. }
  1762. function GetIconRefVariant(inIconRef: IconRef; inVariant: OSType; var outTransform: IconTransformType): IconRef; external name '_GetIconRefVariant';
  1763. {
  1764. ==============================================================================
  1765. Icon files (.icns files)
  1766. ==============================================================================
  1767. }
  1768. {
  1769. RegisterIconRefFromIconFile
  1770. This routine adds a new entry to the IconRef registry. Other clients will be
  1771. able to access it using the (creator, iconType) pair specified here.
  1772. Lower-case creators are reserved for the system.
  1773. If the creator is kSystemIconsCreator and the iconType is 0, a new IconRef
  1774. is always returned. Otherwise, if the creator and type have already been
  1775. registered, the previously registered IconRef is returned.
  1776. This routine increments the reference count of the IconRef. Call ReleaseIconRef()
  1777. when you're done with it.
  1778. }
  1779. {
  1780. * RegisterIconRefFromIconFile()
  1781. *
  1782. * Availability:
  1783. * Non-Carbon CFM: in IconServicesLib 9.0 and later
  1784. * CarbonLib: in CarbonLib 1.0 and later
  1785. * Mac OS X: in version 10.0 and later
  1786. }
  1787. function RegisterIconRefFromIconFile(creator: OSType; iconType: OSType; const (*var*) iconFile: FSSpec; var theIconRef: IconRef): OSErr; external name '_RegisterIconRefFromIconFile';
  1788. {
  1789. ReadIconFile
  1790. Read the specified icon file into the icon family handle.
  1791. The caller is responsible for disposing the iconFamily
  1792. }
  1793. {
  1794. * ReadIconFile()
  1795. *
  1796. * Availability:
  1797. * Non-Carbon CFM: in IconServicesLib 9.0 and later
  1798. * CarbonLib: in CarbonLib 1.0 and later
  1799. * Mac OS X: in version 10.0 and later
  1800. }
  1801. function ReadIconFile(const (*var*) iconFile: FSSpec; var iconFamily: IconFamilyHandle): OSErr; external name '_ReadIconFile';
  1802. { ReadIconFromFSRef }
  1803. {
  1804. * ReadIconFromFSRef()
  1805. *
  1806. * Discussion:
  1807. * This routine reads an icon (icns) file into memory.
  1808. *
  1809. * Parameters:
  1810. *
  1811. * ref:
  1812. * The FSRef for the icon file.
  1813. *
  1814. * iconFamily:
  1815. * The handle for the icon family.
  1816. *
  1817. * Availability:
  1818. * Non-Carbon CFM: not available
  1819. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  1820. * Mac OS X: in version 10.1 and later
  1821. }
  1822. function ReadIconFromFSRef(const (*var*) ref: FSRef; var iconFamily: IconFamilyHandle): OSStatus; external name '_ReadIconFromFSRef';
  1823. {
  1824. WriteIconFile
  1825. Write the iconFamily handle to the specified file
  1826. }
  1827. {
  1828. * WriteIconFile()
  1829. *
  1830. * Availability:
  1831. * Non-Carbon CFM: in IconServicesLib 9.0 and later
  1832. * CarbonLib: in CarbonLib 1.0 and later
  1833. * Mac OS X: in version 10.0 and later
  1834. }
  1835. function WriteIconFile(iconFamily: IconFamilyHandle; const (*var*) iconFile: FSSpec): OSErr; external name '_WriteIconFile';
  1836. {$ALIGN MAC68K}
  1837. end.