2 // NSMenu+RepresentedObjectAccessors.h
5 // Created by Joe Wreschnig on 3/4/13.
9 #import <Cocoa/Cocoa.h>
11 @interface
NSMenu (RepresentedObjectAccessors
)
12 // Helpers for using represented objects in menu items.
14 - (NSMenuItem
*)itemWithRepresentedObject
:(id
)object
;
15 // Returns the first menu item in the receiver that has a given
16 // represented object.
18 - (void)removeItemWithRepresentedObject
:(id
)object
;
19 // Removes the first menu item representing the given object in the
22 // After it removes the menu item, this method posts an
23 // NSMenuDidRemoveItemNotification.
25 - (NSMenuItem
*)lastItem
;
26 // Return the last menu item in the receiver, or nil if the menu
29 - (void)removeLastItem
;
30 // Removes the last menu item in the receiver, if there is one.
32 // After and if it removes the menu item, this method posts an
33 // NSMenuDidRemoveItemNotification.
37 @interface
NSPopUpButton (RepresentedObjectAccessors
)
39 - (NSMenuItem
*)itemWithRepresentedObject
:(id
)object
;
40 // Returns the first item in the receiver's menu that has a given
41 // represented object.
43 - (void)selectItemWithRepresentedObject
:(id
)object
;
44 // Selects the first item in the receiver's menu that has a give
45 // represented object.