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

1412 lines
38 KiB

  1. /*
  2. File: HIToolbar.h
  3. Contains: Toolbar and Toolbar Item API
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __HITOOLBAR__
  11. #define __HITOOLBAR__
  12. #ifndef __ICONS__
  13. #include <Icons.h>
  14. #endif
  15. #ifndef __HIOBJECT__
  16. #include <HIObject.h>
  17. #endif
  18. #ifndef __MENUS__
  19. #include <Menus.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. typedef HIObjectRef HIToolbarRef;
  31. typedef HIObjectRef HIToolbarItemRef;
  32. /*----------------------------------------------------------------------------------*/
  33. /* Standard Toolbox-provided item identifiers */
  34. /*----------------------------------------------------------------------------------*/
  35. #define kHIToolbarSeparatorIdentifier CFSTR("com.apple.hitoolbox.toolbar.separator")
  36. #define kHIToolbarSpaceIdentifier CFSTR("com.apple.hitoolbox.toolbar.space")
  37. #define kHIToolbarFlexibleSpaceIdentifier CFSTR("com.apple.hitoolbox.toolbar.flexiblespace")
  38. #define kHIToolbarCustomizeIdentifier CFSTR("com.apple.hitoolbox.toolbar.customize")
  39. #define kHIToolbarPrintItemIdentifier CFSTR("com.apple.hitoolbox.toolbar.print")
  40. #define kHIToolbarFontsItemIdentifier CFSTR("com.apple.hitoolbox.toolbar.fonts")
  41. /*
  42. * Summary:
  43. * Toolbar Display Mode
  44. */
  45. enum {
  46. /*
  47. * This indicates to use the default display mode. Currently, this is
  48. * defined as being both icon and label, but could change in the
  49. * future.
  50. */
  51. kHIToolbarDisplayModeDefault = 0,
  52. /*
  53. * This indicates to display the image as well as the label of the
  54. * toolbar items.
  55. */
  56. kHIToolbarDisplayModeIconAndLabel = 1,
  57. /*
  58. * This indicates that only the image should be shown.
  59. */
  60. kHIToolbarDisplayModeIconOnly = 2,
  61. /*
  62. * This indicates that only the label should be shown.
  63. */
  64. kHIToolbarDisplayModeLabelOnly = 3
  65. };
  66. typedef UInt32 HIToolbarDisplayMode;
  67. /*
  68. * Summary:
  69. * Toolbar Display Size
  70. */
  71. enum {
  72. /*
  73. * This indicates to use the default display size. Currently, this is
  74. * defined as using 32 x 32 icons ("normal" size).
  75. */
  76. kHIToolbarDisplaySizeDefault = 0,
  77. /*
  78. * This size uses a larger text and icon size.
  79. */
  80. kHIToolbarDisplaySizeNormal = 1,
  81. /*
  82. * This size uses a smaller text and icon size.
  83. */
  84. kHIToolbarDisplaySizeSmall = 2
  85. };
  86. typedef UInt32 HIToolbarDisplaySize;
  87. /*
  88. * Summary:
  89. * Toolbar Attributes
  90. */
  91. enum {
  92. /*
  93. * Pass this to indicate no attributes at all.
  94. */
  95. kHIToolbarNoAttributes = 0,
  96. /*
  97. * Pass this attribute to allow the toolbar to save its configuration
  98. * automatically to your application's preferences. You must make
  99. * sure to synchronize the prefs at some point to ensure it gets
  100. * written to disk. The toolbar will also read its config from the
  101. * prefs if this attribute is set.
  102. */
  103. kHIToolbarAutoSavesConfig = (1 << 0),
  104. /*
  105. * This attribute indicates that the toolbar is configurable, i.e.
  106. * the user can drag items around and bring up the configuration
  107. * palette, etc.
  108. */
  109. kHIToolbarIsConfigurable = (1 << 1),
  110. kHIToolbarValidAttrs = kHIToolbarAutoSavesConfig | kHIToolbarIsConfigurable
  111. };
  112. /*
  113. * Summary:
  114. * Toolbar Commands
  115. */
  116. enum {
  117. /*
  118. * Sending this to a window with a toolbar will cause the
  119. * configuration sheet to appear. You can set a menu item's command
  120. * to this command ID and it will be handled and updated
  121. * automatically for you.
  122. */
  123. kHICommandCustomizeToolbar = FOUR_CHAR_CODE('tcfg'),
  124. /*
  125. * This command causes a window's toolbar to be shown. You can set a
  126. * menu item's command to this ID and it will be handled and updated
  127. * automatically for you.
  128. */
  129. kHICommandShowToolbar = FOUR_CHAR_CODE('tbsh'),
  130. /*
  131. * This command causes a window's toolbar to be hidden. You can set a
  132. * menu item's command to this ID and it will be handled and updated
  133. * automatically for you.
  134. */
  135. kHICommandHideToolbar = FOUR_CHAR_CODE('tbhd')
  136. };
  137. /*
  138. Parameter Information:
  139. kEventToolbarGetDefaultIdentifiers
  140. --> kEventParamToolbar typeHIToolbarRef
  141. --> kEventParamMutableArray typeCFMutableArrayRef
  142. kEventToolbarGetAllowedIdentifiers
  143. --> kEventParamToolbar typeHIToolbarRef
  144. --> kEventParamMutableArray typeCFMutableArrayRef
  145. kEventToolbarCreateItemWithIdentifier
  146. --> kEventParamToolbar typeHIToolbarRef
  147. --> kEventParamToolbarItemIdentifier typeCFStringRef
  148. --> kEventParamToolbarItemConfigData typeCFTypeRef (optional)
  149. <-- kEventParamToolbarItem typeHIToolbarItemRef
  150. kEventToolbarCreateItemFromDrag
  151. --> kEventParamDragRef typeDragRef
  152. <-- kEventParamToolbarItem typeHIToolbarItemRef
  153. */
  154. /*
  155. * Summary:
  156. * Toolbar Events
  157. */
  158. enum {
  159. /*
  160. * This event is sent to the delegate to get a list of all of the
  161. * default item identifiers that should be created for a toolbar. You
  162. * are passed a mutable array to fill in with the identifiers.
  163. */
  164. kEventToolbarGetDefaultIdentifiers = 1,
  165. /*
  166. * This event is sent to the delegate to get a list of all the items
  167. * which could possibly be added to the toolbar. This is sent out
  168. * when the configuration sheet is about to be displayed.You are
  169. * passed a mutable array to fill in with the identifiers.
  170. */
  171. kEventToolbarGetAllowedIdentifiers = 2,
  172. /*
  173. * This event is sent to the delegate to when we need to create an
  174. * item from an identifier.
  175. */
  176. kEventToolbarCreateItemWithIdentifier = 3,
  177. /*
  178. * This event is sent to the delegate to when we need to create an
  179. * item from a drag. This allows you to be able to drag items into a
  180. * toolbar that aren't normal toolbar items. You might use this to
  181. * allow your toolbar to accept file system items, for example.
  182. */
  183. kEventToolbarCreateItemFromDrag = 4
  184. };
  185. /*
  186. * Summary:
  187. * Toolbar Item Model Events
  188. */
  189. enum {
  190. /*
  191. * This event is sent to the item (itself) when the image changes.
  192. * Any interested parties can install handlers on the toolbar item to
  193. * receive notifications.
  194. */
  195. kEventToolbarItemImageChanged = 1,
  196. /*
  197. * This event is sent to the item (itself) when the label changes.
  198. * Any interested parties can install handlers on the toolbar item to
  199. * receive notifications.
  200. */
  201. kEventToolbarItemLabelChanged = 2,
  202. /*
  203. * This event is sent to the item (itself) when the help text
  204. * changes. Any interested parties can install handlers on the
  205. * toolbar item to receive notifications.
  206. */
  207. kEventToolbarItemHelpTextChanged = 3,
  208. /*
  209. * This event is sent to the item (itself) when the command ID
  210. * changes. Any interested parties can install handlers on the
  211. * toolbar item to receive notifications.
  212. */
  213. kEventToolbarItemCommandIDChanged = 4,
  214. /*
  215. * This event is sent to the item (itself) when the toolbar is going
  216. * to write out the configuration information for the item. Any
  217. * custom items can listen for this event and add any extra
  218. * information to what is written out into the config so that it can
  219. * be reanimated later on from the same config data. Typically, you'd
  220. * not need to handle this event.
  221. */
  222. kEventToolbarItemGetPersistentData = 5,
  223. /*
  224. * This event is sent to the toolbar item when it is time to create a
  225. * view for it to display its contents. Implementors of custom
  226. * toolbar items can install a handler for this event to create their
  227. * own custom views for their items.
  228. */
  229. kEventToolbarItemCreateCustomView = 6,
  230. /*
  231. * This event is sent to the item (itself) when the enabled state
  232. * changes. Any interested parties can install handlers on the
  233. * toolbar item to receive notifications.
  234. */
  235. kEventToolbarItemEnabledStateChanged = 7,
  236. /*
  237. * This event is sent when a toolbar item is clicked. Subclasses of
  238. * toolbar items can choose to do special actions by overriding this
  239. * event. If this event is unhandled, the default action of sending a
  240. * command event will occur.
  241. */
  242. kEventToolbarItemPerformAction = 8
  243. };
  244. /*
  245. * Summary:
  246. * Toolbar Item Attributes
  247. */
  248. enum {
  249. kHIToolbarItemNoAttributes = 0,
  250. kHIToolbarItemAllowDuplicates = (1 << 0),
  251. kHIToolbarItemCantBeRemoved = (1 << 1),
  252. /*
  253. * This item cannot be moved at all by the user. It is anchored to
  254. * the left of the toolbar. It is important that there not be any
  255. * unanchored items to the left of this item, else dragging items
  256. * around will be a bit wacky. It is up you you, the home viewer, to
  257. * make sure that anchored items are all on the left. This allows you
  258. * to do toolbars like the the one in the System Preferences app,
  259. * where the first couple of items are stuck in place.
  260. */
  261. kHIToolbarItemAnchoredLeft = (1 << 2),
  262. kHIToolbarItemIsSeparator = (1 << 3),
  263. /*
  264. * If this attribute bit is set, the command that gets sent out will
  265. * be directed at the user focus instead of at the window the toolbar
  266. * is attached to.
  267. */
  268. kHIToolbarItemSendCmdToUserFocus = (1 << 4),
  269. kHIToolbarItemValidAttrs = kHIToolbarItemAllowDuplicates | kHIToolbarItemIsSeparator | kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemSendCmdToUserFocus,
  270. kHIToolbarItemMutableAttrs = kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft
  271. };
  272. /*======================================================================================*/
  273. /* FUNCTIONS */
  274. /*======================================================================================*/
  275. #define _HIToolbarCreate HIToolbarCreate
  276. /*
  277. * HIToolbarCreate()
  278. *
  279. * Discussion:
  280. * Creates a toolbar.
  281. *
  282. * Parameters:
  283. *
  284. * inIdentifier:
  285. * The identifier of the toolbar. If you specify that the toolbar
  286. * auto-saves its configuration, this identifier is used to mark
  287. * the config info in your application's preferences. You must
  288. * specify an identifier.
  289. *
  290. * inAttributes:
  291. * Any attributes you wish to specify.
  292. *
  293. * outToolbar:
  294. * The toolbar reference to your shiny new toolbar.
  295. *
  296. * Result:
  297. * An operating system result code.
  298. *
  299. * Availability:
  300. * Non-Carbon CFM: not available
  301. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  302. * Mac OS X: in version 10.2 and later
  303. */
  304. EXTERN_API_C( OSStatus )
  305. HIToolbarCreate(
  306. CFStringRef inIdentifier,
  307. OptionBits inAttributes,
  308. HIToolbarRef * outToolbar);
  309. #define _HIToolbarGetAttributes HIToolbarGetAttributes
  310. /*
  311. * HIToolbarGetAttributes()
  312. *
  313. * Discussion:
  314. * Returns the attributes for the given toolbar.
  315. *
  316. * Parameters:
  317. *
  318. * inToolbar:
  319. * The toolbar whose attributes you desire.
  320. *
  321. * outAttributes:
  322. * The attributes.
  323. *
  324. * Result:
  325. * An operating system result code.
  326. *
  327. * Availability:
  328. * Non-Carbon CFM: not available
  329. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  330. * Mac OS X: in version 10.2 and later
  331. */
  332. EXTERN_API_C( OSStatus )
  333. HIToolbarGetAttributes(
  334. HIToolbarRef inToolbar,
  335. OptionBits * outAttributes);
  336. #define _HIToolbarChangeAttributes HIToolbarChangeAttributes
  337. /*
  338. * HIToolbarChangeAttributes()
  339. *
  340. * Discussion:
  341. * Changes the attributes of a toolbar.
  342. *
  343. * Parameters:
  344. *
  345. * inToolbar:
  346. * The toolbar whose attributes you want to change.
  347. *
  348. * inAttrsToSet:
  349. * The attributes you wish to set/enable.
  350. *
  351. * inAttrsToClear:
  352. * The attributes you wish to clear/disable.
  353. *
  354. * Result:
  355. * An operating system result code.
  356. *
  357. * Availability:
  358. * Non-Carbon CFM: not available
  359. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  360. * Mac OS X: in version 10.2 and later
  361. */
  362. EXTERN_API_C( OSStatus )
  363. HIToolbarChangeAttributes(
  364. HIToolbarRef inToolbar,
  365. OptionBits inAttrsToSet,
  366. OptionBits inAttrsToClear);
  367. #define _HIToolbarGetDisplayMode HIToolbarGetDisplayMode
  368. /*
  369. * HIToolbarGetDisplayMode()
  370. *
  371. * Discussion:
  372. * Returns the current display mode of a toolbar.
  373. *
  374. * Parameters:
  375. *
  376. * inToolbar:
  377. * The toolbar whose display mode you wish to receive.
  378. *
  379. * outDisplayMode:
  380. * The display mode.
  381. *
  382. * Result:
  383. * An operating system result code.
  384. *
  385. * Availability:
  386. * Non-Carbon CFM: not available
  387. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  388. * Mac OS X: in version 10.2 and later
  389. */
  390. EXTERN_API_C( OSStatus )
  391. HIToolbarGetDisplayMode(
  392. HIToolbarRef inToolbar,
  393. HIToolbarDisplayMode * outDisplayMode);
  394. #define _HIToolbarSetDisplayMode HIToolbarSetDisplayMode
  395. /*
  396. * HIToolbarSetDisplayMode()
  397. *
  398. * Discussion:
  399. * Sets the current display mode of a toolbar.
  400. *
  401. * Parameters:
  402. *
  403. * inToolbar:
  404. * The toolbar whose display mode you wish to set.
  405. *
  406. * inDisplayMode:
  407. * The display mode. If the toolbar is visible, it will be redrawn.
  408. *
  409. * Result:
  410. * An operating system result code.
  411. *
  412. * Availability:
  413. * Non-Carbon CFM: not available
  414. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  415. * Mac OS X: in version 10.2 and later
  416. */
  417. EXTERN_API_C( OSStatus )
  418. HIToolbarSetDisplayMode(
  419. HIToolbarRef inToolbar,
  420. HIToolbarDisplayMode inDisplayMode);
  421. #define _HIToolbarGetDisplaySize HIToolbarGetDisplaySize
  422. /*
  423. * HIToolbarGetDisplaySize()
  424. *
  425. * Discussion:
  426. * Gets the current display size of a toolbar.
  427. *
  428. * Parameters:
  429. *
  430. * inToolbar:
  431. * The toolbar whose display size you wish to get.
  432. *
  433. * outSize:
  434. * The display size.
  435. *
  436. * Result:
  437. * An operating system result code.
  438. *
  439. * Availability:
  440. * Non-Carbon CFM: not available
  441. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  442. * Mac OS X: in version 10.2 and later
  443. */
  444. EXTERN_API_C( OSStatus )
  445. HIToolbarGetDisplaySize(
  446. HIToolbarRef inToolbar,
  447. HIToolbarDisplaySize * outSize);
  448. #define _HIToolbarSetDisplaySize HIToolbarSetDisplaySize
  449. /*
  450. * HIToolbarSetDisplaySize()
  451. *
  452. * Discussion:
  453. * Sets the current display size of a toolbar.
  454. *
  455. * Parameters:
  456. *
  457. * inToolbar:
  458. * The toolbar whose display size you wish to set.
  459. *
  460. * inSize:
  461. * The display size. If the toolbar is visible, it will be redrawn.
  462. *
  463. * Result:
  464. * An operating system result code.
  465. *
  466. * Availability:
  467. * Non-Carbon CFM: not available
  468. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  469. * Mac OS X: in version 10.2 and later
  470. */
  471. EXTERN_API_C( OSStatus )
  472. HIToolbarSetDisplaySize(
  473. HIToolbarRef inToolbar,
  474. HIToolbarDisplaySize inSize);
  475. #define _HIToolbarCopyIdentifier HIToolbarCopyIdentifier
  476. /*
  477. * HIToolbarCopyIdentifier()
  478. *
  479. * Discussion:
  480. * Returns the identifier for a toolbar.
  481. *
  482. * Parameters:
  483. *
  484. * inToolbar:
  485. * The toolbar whose identifier you wish to get.
  486. *
  487. * outIdentifier:
  488. * The identifier. You must release it when you are finished with
  489. * it.
  490. *
  491. * Result:
  492. * An operating system result code.
  493. *
  494. * Availability:
  495. * Non-Carbon CFM: not available
  496. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  497. * Mac OS X: in version 10.2 and later
  498. */
  499. EXTERN_API_C( OSStatus )
  500. HIToolbarCopyIdentifier(
  501. HIToolbarRef inToolbar,
  502. CFStringRef * outIdentifier);
  503. #define _HIToolbarCopyItems HIToolbarCopyItems
  504. /*
  505. * HIToolbarCopyItems()
  506. *
  507. * Discussion:
  508. * Returns the array of toolbar items for a toolbar.
  509. *
  510. * Parameters:
  511. *
  512. * inToolbar:
  513. * The toolbar whose items you wish to receive.
  514. *
  515. * outItems:
  516. * The array of toolbar items owned by the toolbar. You must
  517. * release the array when you are finished with it.
  518. *
  519. * Result:
  520. * An operating system result code.
  521. *
  522. * Availability:
  523. * Non-Carbon CFM: not available
  524. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  525. * Mac OS X: in version 10.2 and later
  526. */
  527. EXTERN_API_C( OSStatus )
  528. HIToolbarCopyItems(
  529. HIToolbarRef inToolbar,
  530. CFArrayRef * outItems);
  531. /*
  532. * HIToolbarCreateItemWithIdentifier()
  533. *
  534. * Discussion:
  535. * Creates an item specified by a particular identifier. Using this
  536. * function allows you to create any item a delegate supports by
  537. * naming its identifier. It also allows you to create standard
  538. * items supplied by the Toolbox, such as the separator item.
  539. *
  540. * Parameters:
  541. *
  542. * inToolbar:
  543. * The toolbar you are adding to.
  544. *
  545. * inIdentifier:
  546. * The identifier of the item you wish to add.
  547. *
  548. * inConfigData:
  549. * Any config data required by the item to safely construct.
  550. * Standard items do not require any extra data, so NULL can be
  551. * passed.
  552. *
  553. * outItem:
  554. * The newly created toolbar item.
  555. *
  556. * Result:
  557. * An operating system result code.
  558. *
  559. * Availability:
  560. * Non-Carbon CFM: not available
  561. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  562. * Mac OS X: in version 10.2 and later
  563. */
  564. EXTERN_API_C( OSStatus )
  565. HIToolbarCreateItemWithIdentifier(
  566. HIToolbarRef inToolbar,
  567. CFStringRef inIdentifier,
  568. CFTypeRef inConfigData, /* can be NULL */
  569. HIToolbarItemRef * outItem);
  570. #define _HIToolbarInsertItemAtIndex HIToolbarInsertItemAtIndex
  571. /*
  572. * HIToolbarInsertItemAtIndex()
  573. *
  574. * Discussion:
  575. * Inserts a toolbar item at a given index into a toolbar.
  576. * Generally, you should always add items via identifier, and not
  577. * with this routine.
  578. *
  579. * Parameters:
  580. *
  581. * inToolbar:
  582. * The toolbar to receive the new item.
  583. *
  584. * inItem:
  585. * The item reference of the toolbar item you are adding.
  586. *
  587. * inIndex:
  588. * The index you wish to add the item at. This index is zero-based.
  589. *
  590. * Result:
  591. * An operating system result code.
  592. *
  593. * Availability:
  594. * Non-Carbon CFM: not available
  595. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  596. * Mac OS X: in version 10.2 and later
  597. */
  598. EXTERN_API_C( OSStatus )
  599. HIToolbarInsertItemAtIndex(
  600. HIToolbarRef inToolbar,
  601. HIToolbarItemRef inItem,
  602. CFIndex inIndex);
  603. #define _HIToolbarAppendItem HIToolbarAppendItem
  604. /*
  605. * HIToolbarAppendItem()
  606. *
  607. * Discussion:
  608. * Appends an item to the end of a toolbar. Generally, you should
  609. * always add items via identifier, and not with this routine.
  610. *
  611. * Parameters:
  612. *
  613. * inToolbar:
  614. * The toolbar to receive the new item.
  615. *
  616. * inItem:
  617. * The item reference of the toolbar item you are adding.
  618. *
  619. * Result:
  620. * An operating system result code.
  621. *
  622. * Availability:
  623. * Non-Carbon CFM: not available
  624. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  625. * Mac OS X: in version 10.2 and later
  626. */
  627. EXTERN_API_C( OSStatus )
  628. HIToolbarAppendItem(
  629. HIToolbarRef inToolbar,
  630. HIToolbarItemRef inItem);
  631. #define _HIToolbarRemoveItemAtIndex HIToolbarRemoveItemAtIndex
  632. /*
  633. * HIToolbarRemoveItemAtIndex()
  634. *
  635. * Discussion:
  636. * Removes an item at a given index from a toolbar.
  637. *
  638. * Parameters:
  639. *
  640. * inToolbar:
  641. * The toolbar you are removing the item from.
  642. *
  643. * inIndex:
  644. * The index of the item to remove. This index is zero-based.
  645. *
  646. * Result:
  647. * An operating system result code.
  648. *
  649. * Availability:
  650. * Non-Carbon CFM: not available
  651. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  652. * Mac OS X: in version 10.2 and later
  653. */
  654. EXTERN_API_C( OSStatus )
  655. HIToolbarRemoveItemAtIndex(
  656. HIToolbarRef inToolbar,
  657. CFIndex inIndex);
  658. #define _HIToolbarSetDelegate HIToolbarSetDelegate
  659. /*
  660. * HIToolbarSetDelegate()
  661. *
  662. * Discussion:
  663. * Sets the delegate event target for a toolbar. This is necessary
  664. * for a toolbar to work properly if it wants items of its own. The
  665. * delegate is who is asked to create toolbar items. If the delegate
  666. * does not respond, the toolbar will attempt to create a toolbar
  667. * item, but it can only create the standard items defined at the
  668. * top of this header.
  669. *
  670. * Parameters:
  671. *
  672. * inToolbar:
  673. * The toolbar you are removing the item from.
  674. *
  675. * inDelegate:
  676. * The HIObjectRef to act as the delegate.
  677. *
  678. * Result:
  679. * An operating system result code.
  680. *
  681. * Availability:
  682. * Non-Carbon CFM: not available
  683. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  684. * Mac OS X: in version 10.2 and later
  685. */
  686. EXTERN_API_C( OSStatus )
  687. HIToolbarSetDelegate(
  688. HIToolbarRef inToolbar,
  689. HIObjectRef inDelegate);
  690. #define _HIToolbarGetDelegate HIToolbarGetDelegate
  691. /*
  692. * HIToolbarGetDelegate()
  693. *
  694. * Discussion:
  695. * Returns the current delegate in use by a toolbar.
  696. *
  697. * Parameters:
  698. *
  699. * inToolbar:
  700. * The toolbar you want the delegate from.
  701. *
  702. * Result:
  703. * An HIObjectRef.
  704. *
  705. * Availability:
  706. * Non-Carbon CFM: not available
  707. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  708. * Mac OS X: in version 10.2 and later
  709. */
  710. EXTERN_API_C( HIObjectRef )
  711. HIToolbarGetDelegate(HIToolbarRef inToolbar);
  712. /*==========================================================================*/
  713. /* HITOOLBARITEM */
  714. /*==========================================================================*/
  715. /* The HIObject class ID for the ToolbarItem class. */
  716. #define kHIToolbarItemClassID CFSTR("com.apple.hitoolbaritem")
  717. /* Required construction parameters */
  718. /* */
  719. /* You must pass these parameters in the initialization event if you are */
  720. /* subclassing the toolbar item */
  721. /* */
  722. /* kEventParamToolbarItemIdentifier typeCFStringRef */
  723. /* kEventParamAttibutes typeUInt32 */
  724. #define _HIToolbarItemCreate HIToolbarItemCreate
  725. /*
  726. * HIToolbarItemCreate()
  727. *
  728. * Discussion:
  729. * Creates a toolbar item for use in a toolbar. Typically, you would
  730. * create toolbar items in your delegate. When a toolbar needs to
  731. * create an item with a given identifier, your delegate is asked to
  732. * create it.
  733. *
  734. * Parameters:
  735. *
  736. * inIdentifier:
  737. * The identifier of the item in question.
  738. *
  739. * inOptions:
  740. * Any options for the item.
  741. *
  742. * outItem:
  743. * The item you created.
  744. *
  745. * Result:
  746. * An operating system result code.
  747. *
  748. * Availability:
  749. * Non-Carbon CFM: not available
  750. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  751. * Mac OS X: in version 10.2 and later
  752. */
  753. EXTERN_API_C( OSStatus )
  754. HIToolbarItemCreate(
  755. CFStringRef inIdentifier,
  756. OptionBits inOptions,
  757. HIToolbarItemRef * outItem);
  758. #define _HIToolbarItemCopyIdentifier HIToolbarItemCopyIdentifier
  759. /*
  760. * HIToolbarItemCopyIdentifier()
  761. *
  762. * Discussion:
  763. * Returns the identifier of the given item. The toolbar uses this
  764. * identifier when writing the config information to the preferences
  765. * (if set up for auto-config).
  766. *
  767. * Parameters:
  768. *
  769. * inItem:
  770. * The item in question.
  771. *
  772. * outIdentifier:
  773. * The identifier of the item. You should release this string when
  774. * you are finished with it.
  775. *
  776. * Result:
  777. * An operating system result code.
  778. *
  779. * Availability:
  780. * Non-Carbon CFM: not available
  781. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  782. * Mac OS X: in version 10.2 and later
  783. */
  784. EXTERN_API_C( OSStatus )
  785. HIToolbarItemCopyIdentifier(
  786. HIToolbarItemRef inItem,
  787. CFStringRef * outIdentifier);
  788. #define _HIToolbarItemGetAttributes HIToolbarItemGetAttributes
  789. /*
  790. * HIToolbarItemGetAttributes()
  791. *
  792. * Discussion:
  793. * Returns the attributes of the given item.
  794. *
  795. * Parameters:
  796. *
  797. * inItem:
  798. * The item in question.
  799. *
  800. * outAttributes:
  801. * The attributes of the item.
  802. *
  803. * Result:
  804. * An operating system result code.
  805. *
  806. * Availability:
  807. * Non-Carbon CFM: not available
  808. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  809. * Mac OS X: in version 10.2 and later
  810. */
  811. EXTERN_API_C( OSStatus )
  812. HIToolbarItemGetAttributes(
  813. HIToolbarItemRef inItem,
  814. OptionBits * outAttributes);
  815. #define _HIToolbarItemChangeAttributes HIToolbarItemChangeAttributes
  816. /*
  817. * HIToolbarItemChangeAttributes()
  818. *
  819. * Discussion:
  820. * Changes the attributes of a toolbar item. Only those attributes
  821. * defined by the kHIToolbarItemChangeableAttrs can be passed into
  822. * this API. All other options can only be specified at creation.
  823. *
  824. * Parameters:
  825. *
  826. * inItem:
  827. * The item in question.
  828. *
  829. * inAttrsToSet:
  830. * The attributes to set on the item. This value can be
  831. * kHIToolbarItemNoAttributes if you are only clearing attributes.
  832. *
  833. * inAttrsToClear:
  834. * The attributes to clear on the item. This value can be
  835. * kHIToolbarItemNoAttributes if you are only setting attributes.
  836. *
  837. * Result:
  838. * An operating system result code.
  839. *
  840. * Availability:
  841. * Non-Carbon CFM: not available
  842. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  843. * Mac OS X: in version 10.2 and later
  844. */
  845. EXTERN_API_C( OSStatus )
  846. HIToolbarItemChangeAttributes(
  847. HIToolbarItemRef inItem,
  848. OptionBits inAttrsToSet,
  849. OptionBits inAttrsToClear);
  850. #define _HIToolbarItemSetLabel HIToolbarItemSetLabel
  851. /*
  852. * HIToolbarItemSetLabel()
  853. *
  854. * Discussion:
  855. * Sets the label of a toolbar item. This is what the toolbar view
  856. * will display underneath the image. It is also used in the
  857. * configuration palette for configurable toolbars.
  858. *
  859. * Parameters:
  860. *
  861. * inItem:
  862. * The item in question.
  863. *
  864. * inLabel:
  865. * The label. The toolbox will copy the string passed in.
  866. *
  867. * Result:
  868. * An operating system result code.
  869. *
  870. * Availability:
  871. * Non-Carbon CFM: not available
  872. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  873. * Mac OS X: in version 10.2 and later
  874. */
  875. EXTERN_API_C( OSStatus )
  876. HIToolbarItemSetLabel(
  877. HIToolbarItemRef inItem,
  878. CFStringRef inLabel);
  879. #define _HIToolbarItemCopyLabel HIToolbarItemCopyLabel
  880. /*
  881. * HIToolbarItemCopyLabel()
  882. *
  883. * Discussion:
  884. * Returns the label of a toolbar item.
  885. *
  886. * Parameters:
  887. *
  888. * inItem:
  889. * The item in question.
  890. *
  891. * outLabel:
  892. * The label of the item. You should release this when you are
  893. * finished with it.
  894. *
  895. * Result:
  896. * An operating system result code.
  897. *
  898. * Availability:
  899. * Non-Carbon CFM: not available
  900. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  901. * Mac OS X: in version 10.2 and later
  902. */
  903. EXTERN_API_C( OSStatus )
  904. HIToolbarItemCopyLabel(
  905. HIToolbarItemRef inItem,
  906. CFStringRef * outLabel);
  907. #define _HIToolbarItemSetHelpText HIToolbarItemSetHelpText
  908. /*
  909. * HIToolbarItemSetHelpText()
  910. *
  911. * Discussion:
  912. * Sets the text used for help tags for a toolbar item.
  913. *
  914. * Parameters:
  915. *
  916. * inItem:
  917. * The item in question.
  918. *
  919. * inShortText:
  920. * The short help text. This is what is displayed normally by the
  921. * help tag system when the user hovers over the toolbar item with
  922. * the mouse.
  923. *
  924. * inLongText:
  925. * The long help text. This is what is displayed by the help tag
  926. * system when the user hovers over the toolbar item with the
  927. * mouse and holds the command key down. This parameter is
  928. * optional, you may pass NULL.
  929. *
  930. * Result:
  931. * An operating system result code.
  932. *
  933. * Availability:
  934. * Non-Carbon CFM: not available
  935. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  936. * Mac OS X: in version 10.2 and later
  937. */
  938. EXTERN_API_C( OSStatus )
  939. HIToolbarItemSetHelpText(
  940. HIToolbarItemRef inItem,
  941. CFStringRef inShortText,
  942. CFStringRef inLongText); /* can be NULL */
  943. #define _HIToolbarItemCopyHelpText HIToolbarItemCopyHelpText
  944. /*
  945. * HIToolbarItemCopyHelpText()
  946. *
  947. * Discussion:
  948. * Returns the text used for help tags for a toolbar item.
  949. *
  950. * Parameters:
  951. *
  952. * inItem:
  953. * The item in question.
  954. *
  955. * outShortText:
  956. * The short help text. This is what is displayed normally by the
  957. * help tag system when the user hovers over the toolbar item with
  958. * the mouse. You should release this string when you are finished
  959. * with it. If you do not wish to receive the short help text,
  960. * pass NULL for this parameter.
  961. *
  962. * outLongText:
  963. * The long help text. This is what is displayed by the help tag
  964. * system when the user hovers over the toolbar item with the
  965. * mouse and holds the command key down. You should release this
  966. * string when you are finished with it. If you do not wish to
  967. * receive the long help text, pass NULL for this parameter.
  968. *
  969. * Result:
  970. * An operating system result code.
  971. *
  972. * Availability:
  973. * Non-Carbon CFM: not available
  974. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  975. * Mac OS X: in version 10.2 and later
  976. */
  977. EXTERN_API_C( OSStatus )
  978. HIToolbarItemCopyHelpText(
  979. HIToolbarItemRef inItem,
  980. CFStringRef * outShortText, /* can be NULL */
  981. CFStringRef * outLongText); /* can be NULL */
  982. #define _HIToolbarItemSetCommandID HIToolbarItemSetCommandID
  983. /*
  984. * HIToolbarItemSetCommandID()
  985. *
  986. * Discussion:
  987. * Sets the command ID of a toolbar item. When an toolbar item is
  988. * clicked, the default behavior is to send out the command assigned
  989. * to the item. This API lets you set that command ID. The command
  990. * is sent out via the ProcessHICommand API, so it uses Carbon
  991. * Events.
  992. *
  993. * Parameters:
  994. *
  995. * inItem:
  996. * The item in question.
  997. *
  998. * inCommandID:
  999. * The command ID.
  1000. *
  1001. * Result:
  1002. * An operating system result code.
  1003. *
  1004. * Availability:
  1005. * Non-Carbon CFM: not available
  1006. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1007. * Mac OS X: in version 10.2 and later
  1008. */
  1009. EXTERN_API_C( OSStatus )
  1010. HIToolbarItemSetCommandID(
  1011. HIToolbarItemRef inItem,
  1012. MenuCommand inCommandID);
  1013. #define _HIToolbarItemGetCommandID HIToolbarItemGetCommandID
  1014. /*
  1015. * HIToolbarItemGetCommandID()
  1016. *
  1017. * Discussion:
  1018. * Gets the command ID of a toolbar item.
  1019. *
  1020. * Parameters:
  1021. *
  1022. * inItem:
  1023. * The item in question.
  1024. *
  1025. * outCommandID:
  1026. * The command ID.
  1027. *
  1028. * Result:
  1029. * An operating system result code.
  1030. *
  1031. * Availability:
  1032. * Non-Carbon CFM: not available
  1033. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1034. * Mac OS X: in version 10.2 and later
  1035. */
  1036. EXTERN_API_C( OSStatus )
  1037. HIToolbarItemGetCommandID(
  1038. HIToolbarItemRef inItem,
  1039. MenuCommand * outCommandID);
  1040. #define _HIToolbarItemSetIconRef HIToolbarItemSetIconRef
  1041. /*
  1042. * HIToolbarItemSetIconRef()
  1043. *
  1044. * Discussion:
  1045. * Sets the icon for a toolbar item.
  1046. *
  1047. * Parameters:
  1048. *
  1049. * inItem:
  1050. * The item in question.
  1051. *
  1052. * inIcon:
  1053. * The icon ref. The toolbar will create an appropriate CGImageRef
  1054. * for the icon passed in. The icon can be released after this API
  1055. * is called. ooo NOTE: This API may change or disappear!
  1056. *
  1057. * Result:
  1058. * An operating system result code.
  1059. *
  1060. * Availability:
  1061. * Non-Carbon CFM: not available
  1062. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1063. * Mac OS X: in version 10.2 and later
  1064. */
  1065. EXTERN_API_C( OSStatus )
  1066. HIToolbarItemSetIconRef(
  1067. HIToolbarItemRef inItem,
  1068. IconRef inIcon);
  1069. #define _HIToolbarItemSetImage HIToolbarItemSetImage
  1070. /*
  1071. * HIToolbarItemSetImage()
  1072. *
  1073. * Discussion:
  1074. * Sets the image for a toolbar item. Currently, the image should be
  1075. * no higher than 32 pixels. This image is used both in the toolbar
  1076. * as well as the configuration sheet, if the toolbar is
  1077. * configurable.
  1078. *
  1079. * Parameters:
  1080. *
  1081. * inItem:
  1082. * The item in question.
  1083. *
  1084. * inImage:
  1085. * The image. This image is retained by the toolbar item. You may
  1086. * release it after calling this API.
  1087. *
  1088. * Result:
  1089. * An operating system result code.
  1090. *
  1091. * Availability:
  1092. * Non-Carbon CFM: not available
  1093. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1094. * Mac OS X: in version 10.2 and later
  1095. */
  1096. EXTERN_API_C( OSStatus )
  1097. HIToolbarItemSetImage(
  1098. HIToolbarItemRef inItem,
  1099. CGImageRef inImage);
  1100. #define _HIToolbarItemCopyImage HIToolbarItemCopyImage
  1101. /*
  1102. * HIToolbarItemCopyImage()
  1103. *
  1104. * Discussion:
  1105. * Returns the image for a toolbar item. This image is already
  1106. * retained by the time you receive it, so you can release it when
  1107. * you are done with it.
  1108. *
  1109. * Parameters:
  1110. *
  1111. * inItem:
  1112. * The item in question.
  1113. *
  1114. * outImage:
  1115. * The retained image. You should release it when finished with it.
  1116. *
  1117. * Result:
  1118. * An operating system result code.
  1119. *
  1120. * Availability:
  1121. * Non-Carbon CFM: not available
  1122. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1123. * Mac OS X: in version 10.2 and later
  1124. */
  1125. EXTERN_API_C( OSStatus )
  1126. HIToolbarItemCopyImage(
  1127. HIToolbarItemRef inItem,
  1128. CGImageRef * outImage);
  1129. #define _HIToolbarItemSetMenu HIToolbarItemSetMenu
  1130. /*
  1131. * HIToolbarItemSetMenu()
  1132. *
  1133. * Discussion:
  1134. * Sets the submenu for a toolbar item. Normally, items do not have
  1135. * a submenu. You can attach one with this API. The submenu will, by
  1136. * default, show up both in the 'more items' indicator popup
  1137. * attached to the item name. It will also appear if the toolbar is
  1138. * in text only mode and the label is clicked. You should attach a
  1139. * Carbon Event handler to the menu to handle updating the menu
  1140. * items as appropriate before the menu is displayed.
  1141. *
  1142. * Parameters:
  1143. *
  1144. * inItem:
  1145. * The item in question.
  1146. *
  1147. * inMenu:
  1148. * The menu. It is retained by the toolbar item, so you can safely
  1149. * release it after calling this API.
  1150. *
  1151. * Result:
  1152. * An operating system result code.
  1153. *
  1154. * Availability:
  1155. * Non-Carbon CFM: not available
  1156. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1157. * Mac OS X: in version 10.2 and later
  1158. */
  1159. EXTERN_API_C( OSStatus )
  1160. HIToolbarItemSetMenu(
  1161. HIToolbarItemRef inItem,
  1162. MenuRef inMenu);
  1163. #define _HIToolbarItemCopyMenu HIToolbarItemCopyMenu
  1164. /*
  1165. * HIToolbarItemCopyMenu()
  1166. *
  1167. * Discussion:
  1168. * Gets the submenu for a toolbar item.
  1169. *
  1170. * Parameters:
  1171. *
  1172. * inItem:
  1173. * The item in question.
  1174. *
  1175. * outMenu:
  1176. * The retained menu. You should release it when you are finished
  1177. * with it.
  1178. *
  1179. * Result:
  1180. * An operating system result code.
  1181. *
  1182. * Availability:
  1183. * Non-Carbon CFM: not available
  1184. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1185. * Mac OS X: in version 10.2 and later
  1186. */
  1187. EXTERN_API_C( OSStatus )
  1188. HIToolbarItemCopyMenu(
  1189. HIToolbarItemRef inItem,
  1190. MenuRef * outMenu);
  1191. #define _HIToolbarItemGetToolbar HIToolbarItemGetToolbar
  1192. /*
  1193. * HIToolbarItemGetToolbar()
  1194. *
  1195. * Discussion:
  1196. * Gets the toolbar a toolbar item is attached to.
  1197. *
  1198. * Parameters:
  1199. *
  1200. * inItem:
  1201. * The item in question.
  1202. *
  1203. * Result:
  1204. * The toolbar item reference of the toolbar this item is bound to,
  1205. * or NULL if this toolbar item is not attached to any toolbar.
  1206. *
  1207. * Availability:
  1208. * Non-Carbon CFM: not available
  1209. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1210. * Mac OS X: in version 10.2 and later
  1211. */
  1212. EXTERN_API_C( HIToolbarRef )
  1213. HIToolbarItemGetToolbar(HIToolbarItemRef inItem);
  1214. /*
  1215. * HIToolbarItemIsEnabled()
  1216. *
  1217. * Discussion:
  1218. * Used to determine if a toolbar item is enabled.
  1219. *
  1220. * Parameters:
  1221. *
  1222. * inItem:
  1223. * The item in question.
  1224. *
  1225. * Result:
  1226. * A boolean result.
  1227. *
  1228. * Availability:
  1229. * Non-Carbon CFM: not available
  1230. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1231. * Mac OS X: in version 10.2 and later
  1232. */
  1233. EXTERN_API_C( Boolean )
  1234. HIToolbarItemIsEnabled(HIToolbarItemRef inItem);
  1235. /*
  1236. * HIToolbarItemSetEnabled()
  1237. *
  1238. * Discussion:
  1239. * Enables or disables a toolbar item.
  1240. *
  1241. * Parameters:
  1242. *
  1243. * inItem:
  1244. * The item in question.
  1245. *
  1246. * inEnabled:
  1247. * The new enabled state.
  1248. *
  1249. * Result:
  1250. * An operating system result code.
  1251. *
  1252. * Availability:
  1253. * Non-Carbon CFM: not available
  1254. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1255. * Mac OS X: in version 10.2 and later
  1256. */
  1257. EXTERN_API_C( OSStatus )
  1258. HIToolbarItemSetEnabled(
  1259. HIToolbarItemRef inItem,
  1260. Boolean inEnabled);
  1261. #ifdef PRAGMA_IMPORT_OFF
  1262. #pragma import off
  1263. #elif PRAGMA_IMPORT
  1264. #pragma import reset
  1265. #endif
  1266. #ifdef __cplusplus
  1267. }
  1268. #endif
  1269. #endif /* __HITOOLBAR__ */