cocoa: Enable creating empty menu
This commit is contained in:
parent
49ac363eef
commit
af72842728
1 changed files with 7 additions and 4 deletions
|
@ -251,10 +251,13 @@ int EventFlagsFromNSEvent(NSEvent* event) {
|
|||
}
|
||||
|
||||
- (NSMenu*)menu {
|
||||
if (!menu_ && model_) {
|
||||
menu_.reset([[self menuFromModel:model_] retain]);
|
||||
[menu_ setDelegate:self];
|
||||
}
|
||||
if (menu_)
|
||||
return menu_.get();
|
||||
|
||||
menu_.reset([[NSMenu alloc] initWithTitle:@""]);
|
||||
[menu_ setDelegate:self];
|
||||
if (model_)
|
||||
[self populateWithModel:model_];
|
||||
return menu_.get();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue