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:
Gellert Hegyi 2025-05-23 18:43:49 +02:00 committed by GitHub
commit b9b96a96f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 61 additions and 8 deletions

View file

@ -37,6 +37,18 @@ std::u16string ElectronMenuModel::GetToolTipAt(size_t index) {
return iter == std::end(toolTips_) ? std::u16string() : iter->second;
}
void ElectronMenuModel::SetCustomType(size_t index,
const std::u16string& customType) {
int command_id = GetCommandIdAt(index);
customTypes_[command_id] = customType;
}
std::u16string ElectronMenuModel::GetCustomTypeAt(size_t index) {
const int command_id = GetCommandIdAt(index);
const auto iter = customTypes_.find(command_id);
return iter == std::end(customTypes_) ? std::u16string() : iter->second;
}
void ElectronMenuModel::SetRole(size_t index, const std::u16string& role) {
int command_id = GetCommandIdAt(index);
roles_[command_id] = role;