mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 00:30:58 +00:00
Add implementation of removeAllItems
This commit is contained in:
parent
3f35da7860
commit
3575f0af77
2 changed files with 18 additions and 0 deletions
|
@ -633,6 +633,12 @@ APPKIT_EXPORT_CLASS
|
|||
*/
|
||||
- (void) removeItemAtIndex: (NSInteger)index;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
/** Removes all items
|
||||
*/
|
||||
- (void) removeAllItems;
|
||||
#endif
|
||||
|
||||
/** Sets if a menu does autoenable.
|
||||
*/
|
||||
- (void) setAutoenablesItems: (BOOL)flag;
|
||||
|
|
|
@ -849,6 +849,18 @@ static BOOL menuBarVisible = YES;
|
|||
[self menuChanged];
|
||||
}
|
||||
|
||||
- (void) removeAllItems
|
||||
{
|
||||
NSUInteger count = [_items count];
|
||||
NSUInteger index = 0;
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
// always remove item 0 since the index will chane with each removal..
|
||||
[self removeItemAtIndex: 0];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) itemChanged: (id <NSMenuItem>)anObject
|
||||
{
|
||||
NSNotification *changed;
|
||||
|
|
Loading…
Reference in a new issue