mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: add menu item role palette and header (#45538)
* feat: add menu item role `palette` and `header` * adds comments * refactors new role items to new item types * docs: custom type * docs: note types only available on mac 14+ --------- Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
This commit is contained in:
@@ -213,6 +213,10 @@ void Menu::SetRole(int index, const std::u16string& role) {
|
||||
model_->SetRole(index, role);
|
||||
}
|
||||
|
||||
void Menu::SetCustomType(int index, const std::u16string& customType) {
|
||||
model_->SetCustomType(index, customType);
|
||||
}
|
||||
|
||||
void Menu::Clear() {
|
||||
model_->Clear();
|
||||
}
|
||||
@@ -286,6 +290,7 @@ void Menu::FillObjectTemplate(v8::Isolate* isolate,
|
||||
.SetMethod("setSublabel", &Menu::SetSublabel)
|
||||
.SetMethod("setToolTip", &Menu::SetToolTip)
|
||||
.SetMethod("setRole", &Menu::SetRole)
|
||||
.SetMethod("setCustomType", &Menu::SetCustomType)
|
||||
.SetMethod("clear", &Menu::Clear)
|
||||
.SetMethod("getIndexOfCommandId", &Menu::GetIndexOfCommandId)
|
||||
.SetMethod("getItemCount", &Menu::GetItemCount)
|
||||
|
||||
@@ -116,6 +116,7 @@ class Menu : public gin::Wrappable<Menu>,
|
||||
void SetSublabel(int index, const std::u16string& sublabel);
|
||||
void SetToolTip(int index, const std::u16string& toolTip);
|
||||
void SetRole(int index, const std::u16string& role);
|
||||
void SetCustomType(int index, const std::u16string& customType);
|
||||
void Clear();
|
||||
int GetIndexOfCommandId(int command_id) const;
|
||||
int GetItemCount() const;
|
||||
|
||||
Reference in New Issue
Block a user