mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:04:20 +00:00
Add removeAllItems method
This commit is contained in:
parent
d99c96efcc
commit
e1f3eafb9d
3 changed files with 24 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2023-08-29 Gregory Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSMenu.h (-removeAllItems): Add method declaration.
|
||||
* Source/NSMenu.m (-removeAllItems): Add implementation to remove
|
||||
all menu items in the reciever.
|
||||
|
||||
2023-08-13 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSSwitch.m (-drawRect:): Correct drawing as suggested by
|
||||
|
|
|
@ -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