1 #import "ITCategory-NSMenu.h"
3 @interface NSMenu (HACKHACKHACKHACK)
7 extern void _NSGetMenuItemForCommandKeyEvent (NSMenu *menu, void *chicken, void *taco, void *food);
8 extern MenuRef _NSGetCarbonMenu( NSMenu *menu);
10 @implementation NSMenu (ITCategory)
12 - (void)indentItem:(id <NSMenuItem>)item {
13 [self indentItem:item toLevel:1];
16 - (void)indentItemAtIndex:(int)index {
17 [self indentItemAtIndex:index toLevel:1];
20 - (void)indentItem:(id <NSMenuItem>)item toLevel:(int)indentLevel {
21 [self indentItemAtIndex:[self indexOfItem:item] toLevel:indentLevel];
24 - (void)indentItemAtIndex:(int)index toLevel:(int)indentLevel {
25 if ([[self itemAtIndex:index] respondsToSelector:@selector(setIndentationLevel:)]) {
26 (void)[[self itemAtIndex:index] setIndentationLevel:indentLevel];
28 MenuRef carbonMenu = [self menuRef];
30 SetMenuItemIndent(carbonMenu, index + 1, indentLevel);
39 if( [self respondsToSelector:@selector(_menuImpl)] ) {
40 (void)[self _menuImpl];
45 _NSGetMenuItemForCommandKeyEvent(self, NULL, &w00t, &m00f);
46 carbonMenu = _NSGetCarbonMenu(self);
50 - (void)removeAllItems {
51 int numOfItems = [self numberOfItems];
55 [self removeItemAtIndex:(i-1)];