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 - (NSMenuItem
*)itemWithIdenticalRepresentedObject
:(id
)object
;
16 // Returns the first menu item in the receiver that has a given
17 // represented object.
19 - (NSMenuItem
*)lastItem
;
20 // Return the last menu item in the receiver, or nil if the menu
23 - (void)removeLastItem
;
24 // Removes the last menu item in the receiver, if there is one.
26 // After and if it removes the menu item, this method posts an
27 // NSMenuDidRemoveItemNotification.
31 @interface
NSPopUpButton (RepresentedObjectAccessors
)
33 - (NSMenuItem
*)itemWithRepresentedObject
:(id
)object
;
34 - (NSMenuItem
*)itemWithIdenticalRepresentedObject
:(id
)object
;
35 // Returns the first item in the receiver's menu that has a given
36 // represented object.
38 - (void)selectItemWithRepresentedObject
:(id
)object
;
39 - (void)selectItemWithIdenticalRepresentedObject
:(id
)object
;
40 // Selects the first item in the receiver's menu that has a give
41 // represented object.