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

@ -84,6 +84,8 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
void SetToolTip(size_t index, const std::u16string& toolTip);
std::u16string GetToolTipAt(size_t index);
void SetCustomType(size_t index, const std::u16string& customType);
std::u16string GetCustomTypeAt(size_t index);
void SetRole(size_t index, const std::u16string& role);
std::u16string GetRoleAt(size_t index);
void SetSecondaryLabel(size_t index, const std::u16string& sublabel);
@ -125,6 +127,8 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
base::flat_map<int, std::u16string> toolTips_; // command id -> tooltip
base::flat_map<int, std::u16string> roles_; // command id -> role
base::flat_map<int, std::u16string> sublabels_; // command id -> sublabel
base::flat_map<int, std::u16string>
customTypes_; // command id -> custom type
base::ObserverList<Observer> observers_;
base::WeakPtrFactory<ElectronMenuModel> weak_factory_{this};