Implemented NSMenu removeAllItems method

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37996 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2014-07-14 20:08:26 +00:00
parent 21ffab74f8
commit 61695272c5
3 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2014-07-14 Doug Simons <doug.simons@testplant.com>
* Headers/NSMenu.h
* Source/NSMenu.m: Implemented removeAllItems method.
2013-02-18 Frank Le Grand <frank.legrand@testplant.com>
* Source\NSToolbarItem.m: Fixed a bug where calling setImage:

View file

@ -568,6 +568,10 @@
*/
- (void) removeItemAtIndex: (NSInteger)index;
/** Removes all menu items.
*/
- (void) removeAllItems;
/** Sets if a menu does autoenable.
*/
- (void) setAutoenablesItems: (BOOL)flag;

View file

@ -829,6 +829,15 @@ static BOOL menuBarVisible = YES;
[self menuChanged];
}
- (void) removeAllItems
{
[_items makeObjectsPerformSelector:@selector(setMenu:) withObject:nil];
[_items removeAllObjects];
_menu.needsSizing = YES;
[(NSMenuView*)_view setNeedsSizing: YES];
[self menuChanged];
}
- (void) itemChanged: (id <NSMenuItem>)anObject
{
NSNotification *changed;
@ -1563,6 +1572,10 @@ static BOOL menuBarVisible = YES;
forView: (NSView *)view
withFont: (NSFont *)font
{
NSPoint point = [view frame].origin;
point = [[view superview] convertPoint:point toView:nil];
point = [[view window] convertBaseToScreen: point];
// [[menu window] setFrameOrigin:point];
[menu _rightMouseDisplay: event];
}