* Category which extends NSMenu
*
* Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
* Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
*
- * Copyright (c) 2002 - 2003 iThink Software.
+ * Copyright (c) 2002 - 2004 iThink Software.
* All Rights Reserved
*
*/
- (void)indentItem:(id <NSMenuItem>)item toLevel:(int)indentLevel;
- (void)indentItemAtIndex:(int)index toLevel:(int)indentLevel;
- (MenuRef)menuRef;
+- (void)removeAllItems;
@end
-//
-// ITCategory-NSMenu.m
-// ITKit
-//
-// Created by Joseph Spiros on Sat Sep 27 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
#import "ITCategory-NSMenu.h"
@interface NSMenu (HACKHACKHACKHACK)
return carbonMenu;
}
+- (void)removeAllItems {
+ int numOfItems = [self numberOfItems];
+ int i = numOfItems;
+
+ while (i != 0) {
+ [self removeItemAtIndex:(i-1)];
+ i--;
+ }
+}
+
@end
* Category which extends NSView
*
* Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
* Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
*
- * Copyright (c) 2002 - 2003 iThink Software.
+ * Copyright (c) 2002 - 2004 iThink Software.
* All Rights Reserved
*
*/
@interface NSView (ITCategory)
- (void)removeAllSubviews;
+- (void)removeSubview:(NSView *)subview;
@end
[[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
}
+- (void)removeSubview:(NSView *)subview {
+ if ([subview superview] == self) {
+ [subview removeFromSuperview];
+ }
+}
+
@end