5 // Created by Joseph Spiros on Sat Sep 27 2003.
6 // Copyright (c) 2003 __MyCompanyName__. All rights reserved.
9 #import "ITCategory-NSMenu.h"
11 @interface NSMenu (HACKHACKHACKHACK)
15 extern void _NSGetMenuItemForCommandKeyEvent (NSMenu *menu, void *chicken, void *taco, void *food);
16 extern MenuRef _NSGetCarbonMenu( NSMenu *menu);
18 @implementation NSMenu (ITCategory)
20 - (void)indentItem:(NSMenuItem *)item {
21 [self indentItem:item toLevel:1];
24 - (void)indentItemAtIndex:(int)index {
25 [self indentItemAtIndex:index toLevel:1];
28 - (void)indentItem:(NSMenuItem *)item toLevel:(int)indentLevel {
29 [self indentItemAtIndex:[self indexOfItem:item] toLevel:indentLevel];
32 - (void)indentItemAtIndex:(int)index toLevel:(int)indentLevel {
33 if ([[self itemAtIndex:index] respondsToSelector:@selector(setIndentationLevel:)]) {
34 (void)[[self itemAtIndex:index] setIndentationLevel:indentLevel];
36 MenuRef carbonMenu = [self menuRef];
38 SetMenuItemIndent(carbonMenu, index + 1, indentLevel);
47 if( [self respondsToSelector:@selector(_menuImpl)] ) {
48 (void)[self _menuImpl];
53 _NSGetMenuItemForCommandKeyEvent(self, NULL, &w00t, &m00f);
54 carbonMenu = _NSGetCarbonMenu(self);