5#ifndef MOBROWSER_MENU_HPP
6#define MOBROWSER_MENU_HPP
13#include "mobrowser/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);
67 static std::shared_ptr<CustomMenu> fromId(int32_t
id);
69 CustomMenu(std::string title, MenuItems items);
71 [[nodiscard]] int32_t id()
const;
72 [[nodiscard]] std::string title()
const;
73 void setTitle(
const std::string& title);
80enum class StandardMenuRole {
91 static std::shared_ptr<StandardMenu> create(StandardMenuRole role);
92 static std::shared_ptr<StandardMenu> create(StandardMenuRole role,
94 static std::shared_ptr<StandardMenu> cast(std::shared_ptr<MenuItem> item);
98 [[nodiscard]] StandardMenuRole role()
const;
101 StandardMenuRole role_;
106 [[nodiscard]] int32_t id()
const;
107 void setTitle(
const std::string& title);
108 [[nodiscard]] std::string title()
const;
109 void setEnabled(
bool enabled);
110 [[nodiscard]]
bool isEnabled()
const;
118 bool enabled_ =
true;
125 std::shared_ptr<App> app;
126 std::shared_ptr<Browser> browser;
127 std::shared_ptr<CustomMenuItem> menu_item;
131 std::shared_ptr<App> app;
132 std::shared_ptr<Browser> browser;
133 std::shared_ptr<CustomCheckboxMenuItem> menu_item;
136using CustomMenuItemAction =
139using CustomCheckboxMenuItemAction =
144 static std::shared_ptr<CustomMenuItem> create(std::string title,
145 CustomMenuItemAction action,
147 bool enabled =
true);
148 static std::shared_ptr<CustomMenuItem> cast(std::shared_ptr<MenuItem> item);
149 static std::shared_ptr<CustomMenuItem> fromId(int32_t
id);
152 CustomMenuItemAction action,
154 bool enabled =
true);
156 [[nodiscard]] CustomMenuItemAction action()
const;
157 [[nodiscard]]
Shortcut shortcut()
const;
158 void setShortcut(
Shortcut shortcut);
163 CustomMenuItemAction action,
165 bool enabled =
true);
168 CustomMenuItemAction action_ =
nullptr;
174 static std::shared_ptr<CustomCheckboxMenuItem> create(
176 CustomCheckboxMenuItemAction action,
178 bool checked =
false);
179 static std::shared_ptr<CustomCheckboxMenuItem> cast(
180 std::shared_ptr<MenuItem> item);
181 static std::shared_ptr<CustomCheckboxMenuItem> fromId(int32_t
id);
184 CustomCheckboxMenuItemAction action,
186 bool checked =
false);
188 [[nodiscard]]
bool isChecked()
const;
189 void setChecked(
bool checked);
190 [[nodiscard]] CustomCheckboxMenuItemAction action()
const;
195 CustomCheckboxMenuItemAction action,
197 bool checked =
false);
200 bool checked_ =
false;
201 CustomCheckboxMenuItemAction action_ =
nullptr;
204enum class StandardMenuItemCommandId {
215 kPrintUsingSystemDialog,
237 kReloadBypassingCache,
252 static std::shared_ptr<StandardMenuItem> create(StandardMenuItemCommandId
id);
253 static std::shared_ptr<StandardMenuItem> cast(std::shared_ptr<MenuItem> item);
257 [[nodiscard]] StandardMenuItemCommandId commandId()
const;
260 StandardMenuItemCommandId command_id_;
264std::shared_ptr<SeparatorMenuItem> Separator();
265std::shared_ptr<CustomMenu>
Menu(MenuItems items);
266std::shared_ptr<CustomMenu>
Menu(std::string title, MenuItems items);
267std::shared_ptr<CustomMenuItem> Item(std::string title,
268 CustomMenuItemAction action,
269 bool enabled =
true);
270std::shared_ptr<CustomMenuItem> Item(std::string title,
271 CustomMenuItemAction action,
273 bool enabled =
true);
274std::shared_ptr<CustomCheckboxMenuItem> CheckboxItem(
276 CustomCheckboxMenuItemAction action,
278 bool checked =
false);
280std::shared_ptr<StandardMenu> MacApp(MenuItems items);
281std::shared_ptr<StandardMenu>
File(MenuItems items);
282std::shared_ptr<StandardMenu> Edit(MenuItems items);
283std::shared_ptr<StandardMenu> View(MenuItems items);
284std::shared_ptr<StandardMenu> Window(MenuItems items);
285std::shared_ptr<StandardMenu> Help(MenuItems items);
287std::shared_ptr<CustomMenuItem> About(
const std::shared_ptr<App>& app);
289std::shared_ptr<StandardMenuItem> MacHideApp();
290std::shared_ptr<StandardMenuItem> MacHideOthers();
291std::shared_ptr<StandardMenuItem> MacShowAll();
292std::shared_ptr<StandardMenuItem> Quit();
294std::shared_ptr<StandardMenuItem> SavePageAs();
295std::shared_ptr<StandardMenuItem> Print();
296std::shared_ptr<StandardMenuItem> PrintUsingSystemDialog();
297std::shared_ptr<StandardMenuItem> CloseWindow();
299std::shared_ptr<StandardMenuItem> Undo();
300std::shared_ptr<StandardMenuItem> Redo();
301std::shared_ptr<StandardMenuItem> Cut();
302std::shared_ptr<StandardMenuItem> Copy();
303std::shared_ptr<StandardMenuItem> Paste();
304std::shared_ptr<StandardMenuItem> PasteAndMatchStyle();
305std::shared_ptr<StandardMenuItem> Delete();
306std::shared_ptr<StandardMenuItem> SelectAll();
307std::shared_ptr<StandardMenuItem> Find();
308std::shared_ptr<StandardMenuItem> FindNext();
309std::shared_ptr<StandardMenuItem> FindPrevious();
311std::shared_ptr<StandardMenuItem> GoBack();
312std::shared_ptr<StandardMenuItem> GoForward();
313std::shared_ptr<StandardMenuItem> Stop();
314std::shared_ptr<StandardMenuItem> Reload();
315std::shared_ptr<StandardMenuItem> ReloadBypassingCache();
316std::shared_ptr<StandardMenuItem> ZoomNormal();
317std::shared_ptr<StandardMenuItem> ZoomIn();
318std::shared_ptr<StandardMenuItem> ZoomOut();
319std::shared_ptr<StandardMenuItem> FullScreen();
320std::shared_ptr<StandardMenuItem>
DevTools();
321std::shared_ptr<StandardMenuItem> ViewSource();
323std::shared_ptr<StandardMenuItem> MinimizeWindow();
324std::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