Search code examples
macoscocoa64-bitmenuitemnsmenuitem

64-bit replacement for [NSMenuItemCell menuView] and [NSMenuItemCell setMenuView]


What are the 64-bit replacements for the two methods -[NSMenuItemCell menuView] and -[NSMenuItemCell setMenuView:] of the NSMenuItemCell class? How can I obtain the same results?


Solution

  • The NSMenuItemCell and NSMenuView have never been used to draw menus in any release version of Mac OS X. The following is an excerpt from the Mac OS X Developer Release Notes:

    Notes specific to MacOS X Developer Preview 3

    Menu

    The implementation of menus has changed drastically; NSMenuView and NSMenuItemCell are no longer used, -[NSMenu menuRepresentation] now returns nil, and tear off menus are no longer available. For Developer Preview 3, there is no support for menu item images. If there is no text in the menu item, a placeholder text consisting of "< image >" or "< image name >" will be inserted instead. Menu item state images are not supported either and in their place the standard checkbox or dash for on and mixed states are used.

    (I'm not sure of the exact timeline of pre-Public beta Mac OS X, but for "Developer Preview 3", I'd guess we're talking around the late 1990s here).

    For more info on how menus are currently implemented, see Application Menu and Pop-up List Programming Topics: How Menus Work

    As 一二三 alluded to, you use NSMenu along with NSMenuItem to implement menus. In OS X 10.5 and greater, you can use custom NSView instances in NSMenuItems using the -setView: method.