5#ifndef MOLYBDEN_MENU_HPP
6#define MOLYBDEN_MENU_HPP
13#include "molybden/shortcuts/shortcut.hpp"
20enum class MenuItemType {
25 kCustomCheckboxMenuItem,
31 [[nodiscard]] MenuItemType type()
const;
34 explicit MenuItem(MenuItemType type);
42 static std::shared_ptr<SeparatorMenuItem> create();
43 static std::shared_ptr<SeparatorMenuItem> cast(
44 std::shared_ptr<MenuItem> item);
49using MenuItems = std::vector<std::shared_ptr<MenuItem>>;
53 [[nodiscard]] MenuItems items()
const;
56 Menu(MenuItemType type, MenuItems items);
64 static std::shared_ptr<CustomMenu> create(MenuItems items);
65 static std::shared_ptr<CustomMenu> create(std::string title, MenuItems items);
66 static std::shared_ptr<CustomMenu> cast(std::shared_ptr<MenuItem> item);
68 CustomMenu(std::string title, MenuItems items);
69 [[nodiscard]] std::string title()
const;
75enum class StandardMenuRole {
86 static std::shared_ptr<StandardMenu> create(StandardMenuRole role);
87 static std::shared_ptr<StandardMenu> create(StandardMenuRole role,
89 static std::shared_ptr<StandardMenu> cast(std::shared_ptr<MenuItem> item);
93 [[nodiscard]] StandardMenuRole role()
const;
96 StandardMenuRole role_;
101 [[nodiscard]] int32_t id()
const;
102 [[nodiscard]] std::string title()
const;
103 void setEnabled(
bool enabled);
104 [[nodiscard]]
bool isEnabled()
const;
112 bool enabled_ =
true;
119 std::shared_ptr<App> app;
120 std::shared_ptr<Browser> browser;
121 std::shared_ptr<CustomMenuItem> menu_item;
125 std::shared_ptr<App> app;
126 std::shared_ptr<Browser> browser;
127 std::shared_ptr<CustomCheckboxMenuItem> menu_item;
130using CustomMenuItemAction =
133using CustomCheckboxMenuItemAction =
138 static std::shared_ptr<CustomMenuItem> create(std::string title,
139 CustomMenuItemAction action,
141 bool enabled =
true);
142 static std::shared_ptr<CustomMenuItem> cast(std::shared_ptr<MenuItem> item);
143 static std::shared_ptr<CustomMenuItem> fromId(int32_t
id);
146 CustomMenuItemAction action,
148 bool enabled =
true);
150 [[nodiscard]] CustomMenuItemAction action()
const;
151 [[nodiscard]]
Shortcut shortcut()
const;
152 void setShortcut(
Shortcut shortcut);
157 CustomMenuItemAction action,
159 bool enabled =
true);
162 CustomMenuItemAction action_ =
nullptr;
168 static std::shared_ptr<CustomCheckboxMenuItem> create(
170 CustomCheckboxMenuItemAction action,
172 bool checked =
false);
173 static std::shared_ptr<CustomCheckboxMenuItem> cast(
174 std::shared_ptr<MenuItem> item);
175 static std::shared_ptr<CustomCheckboxMenuItem> fromId(int32_t
id);
178 CustomCheckboxMenuItemAction action,
180 bool checked =
false);
182 [[nodiscard]]
bool isChecked()
const;
183 void setChecked(
bool checked);
184 [[nodiscard]] CustomCheckboxMenuItemAction action()
const;
189 CustomCheckboxMenuItemAction action,
191 bool checked =
false);
194 bool checked_ =
false;
195 CustomCheckboxMenuItemAction action_ =
nullptr;
198enum class StandardMenuItemCommandId {
209 kPrintUsingSystemDialog,
231 kReloadBypassingCache,
246 static std::shared_ptr<StandardMenuItem> create(StandardMenuItemCommandId
id);
247 static std::shared_ptr<StandardMenuItem> cast(std::shared_ptr<MenuItem> item);
251 [[nodiscard]] StandardMenuItemCommandId commandId()
const;
254 StandardMenuItemCommandId command_id_;
258std::shared_ptr<SeparatorMenuItem> Separator();
259std::shared_ptr<CustomMenu>
Menu(MenuItems items);
260std::shared_ptr<CustomMenu>
Menu(std::string title, MenuItems items);
261std::shared_ptr<CustomMenuItem> Item(std::string title,
262 CustomMenuItemAction action,
263 bool enabled =
true);
264std::shared_ptr<CustomMenuItem> Item(std::string title,
265 CustomMenuItemAction action,
267 bool enabled =
true);
268std::shared_ptr<CustomCheckboxMenuItem> CheckboxItem(
270 CustomCheckboxMenuItemAction action,
272 bool checked =
false);
274std::shared_ptr<StandardMenu> MacApp(MenuItems items);
275std::shared_ptr<StandardMenu>
File(MenuItems items);
276std::shared_ptr<StandardMenu> Edit(MenuItems items);
277std::shared_ptr<StandardMenu> View(MenuItems items);
278std::shared_ptr<StandardMenu> Window(MenuItems items);
279std::shared_ptr<StandardMenu> Help(MenuItems items);
281std::shared_ptr<CustomMenuItem> About(
const std::shared_ptr<App>& app);
283std::shared_ptr<StandardMenuItem> MacHideApp();
284std::shared_ptr<StandardMenuItem> MacHideOthers();
285std::shared_ptr<StandardMenuItem> MacShowAll();
286std::shared_ptr<StandardMenuItem> Quit();
288std::shared_ptr<StandardMenuItem> SavePageAs();
289std::shared_ptr<StandardMenuItem> Print();
290std::shared_ptr<StandardMenuItem> PrintUsingSystemDialog();
291std::shared_ptr<StandardMenuItem> CloseWindow();
293std::shared_ptr<StandardMenuItem> Undo();
294std::shared_ptr<StandardMenuItem> Redo();
295std::shared_ptr<StandardMenuItem> Cut();
296std::shared_ptr<StandardMenuItem> Copy();
297std::shared_ptr<StandardMenuItem> Paste();
298std::shared_ptr<StandardMenuItem> PasteAndMatchStyle();
299std::shared_ptr<StandardMenuItem> Delete();
300std::shared_ptr<StandardMenuItem> SelectAll();
301std::shared_ptr<StandardMenuItem> Find();
302std::shared_ptr<StandardMenuItem> FindNext();
303std::shared_ptr<StandardMenuItem> FindPrevious();
305std::shared_ptr<StandardMenuItem> GoBack();
306std::shared_ptr<StandardMenuItem> GoForward();
307std::shared_ptr<StandardMenuItem> Stop();
308std::shared_ptr<StandardMenuItem> Reload();
309std::shared_ptr<StandardMenuItem> ReloadBypassingCache();
310std::shared_ptr<StandardMenuItem> ZoomNormal();
311std::shared_ptr<StandardMenuItem> ZoomIn();
312std::shared_ptr<StandardMenuItem> ZoomOut();
313std::shared_ptr<StandardMenuItem> FullScreen();
314std::shared_ptr<StandardMenuItem>
DevTools();
315std::shared_ptr<StandardMenuItem> ViewSource();
317std::shared_ptr<StandardMenuItem> MinimizeWindow();
318std::shared_ptr<StandardMenuItem> MaximizeWindow();
The file data.
Definition upload_data.hpp:255
A combination of a key code and modifier keys, such as Shift, Alt, etc.
Definition shortcut.hpp:25