feat: add registerAccelerator flag to allow menu items to optionally skip accelerator registration (#15723)
* feat: add registerAccelerator flag to allow menu items to skip registration * docs: add docs for registerAccelerator * docs: re-add accidentally removed line
This commit is contained in:
parent
3748ee49ea
commit
0242818f39
9 changed files with 43 additions and 7 deletions
|
@ -41,6 +41,8 @@ void Menu::AfterInit(v8::Isolate* isolate) {
|
|||
delegate.Get("isCommandIdEnabled", &is_enabled_);
|
||||
delegate.Get("isCommandIdVisible", &is_visible_);
|
||||
delegate.Get("getAcceleratorForCommandId", &get_accelerator_);
|
||||
delegate.Get("shouldRegisterAcceleratorForCommandId",
|
||||
&should_register_accelerator_);
|
||||
delegate.Get("executeCommand", &execute_command_);
|
||||
delegate.Get("menuWillShow", &menu_will_show_);
|
||||
}
|
||||
|
@ -74,6 +76,12 @@ bool Menu::GetAcceleratorForCommandIdWithParams(
|
|||
return mate::ConvertFromV8(isolate(), val, accelerator);
|
||||
}
|
||||
|
||||
bool Menu::ShouldRegisterAcceleratorForCommandId(int command_id) const {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
return should_register_accelerator_.Run(GetWrapper(), command_id);
|
||||
}
|
||||
|
||||
void Menu::ExecuteCommand(int command_id, int flags) {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue