Add website source.
[enjoyable.git] / Categories / NSMenu+RepresentedObjectAccessors.h
1 //
2 // NSMenu+RepresentedObjectAccessors.h
3 // Enjoyable
4 //
5 // Created by Joe Wreschnig on 3/4/13.
6 //
7 //
8
9 #import <Cocoa/Cocoa.h>
10
11 @interface NSMenu (RepresentedObjectAccessors)
12 // Helpers for using represented objects in menu items.
13
14 - (NSMenuItem *)itemWithRepresentedObject:(id)object;
15 // Returns the first menu item in the receiver that has a given
16 // represented object.
17
18 - (void)removeItemWithRepresentedObject:(id)object;
19 // Removes the first menu item representing the given object in the
20 // receiver.
21 //
22 // After it removes the menu item, this method posts an
23 // NSMenuDidRemoveItemNotification.
24
25 - (NSMenuItem *)lastItem;
26 // Return the last menu item in the receiver, or nil if the menu
27 // has no items.
28
29 - (void)removeLastItem;
30 // Removes the last menu item in the receiver, if there is one.
31 //
32 // After and if it removes the menu item, this method posts an
33 // NSMenuDidRemoveItemNotification.
34
35 @end
36
37 @interface NSPopUpButton (RepresentedObjectAccessors)
38
39 - (NSMenuItem *)itemWithRepresentedObject:(id)object;
40 // Returns the first item in the receiver's menu that has a given
41 // represented object.
42
43 - (void)selectItemWithRepresentedObject:(id)object;
44 // Selects the first item in the receiver's menu that has a give
45 // represented object.
46
47 @end