5#ifndef MOLYBDEN_CONTEXT_MENU_HPP
6#define MOLYBDEN_CONTEXT_MENU_HPP
19 bool is_frame =
false;
21 bool is_image =
false;
22 bool is_video =
false;
23 bool is_audio =
false;
24 bool is_canvas =
false;
25 bool is_editable =
false;
28enum class ContextMenuItemType {
29 kStandardContextMenuItem,
31 kCustomContextMenuItem,
37 ContextMenuItemType type()
const;
43 ContextMenuItemType type_;
48 static std::shared_ptr<SeparatorContextMenuItem> create();
49 static std::shared_ptr<SeparatorContextMenuItem> cast(
50 std::shared_ptr<ContextMenuItem> item);
55using ContextMenuItems = std::vector<std::shared_ptr<ContextMenuItem>>;
59 ContextMenuItems items()
const;
62 ContextMenu(ContextMenuItemType type, ContextMenuItems items);
65 ContextMenuItems items_;
70 static std::shared_ptr<CustomContextMenu> create(ContextMenuItems items);
71 static std::shared_ptr<CustomContextMenu> create(std::string title,
72 ContextMenuItems items);
73 static std::shared_ptr<CustomContextMenu> cast(
74 std::shared_ptr<ContextMenuItem> item);
77 std::string title()
const;
85using CustomContextMenuItemAction =
86 std::function<void(std::shared_ptr<Browser>,
88 std::shared_ptr<CustomContextMenuItem>)>;
92 static std::shared_ptr<CustomContextMenuItem> create(
94 CustomContextMenuItemAction action,
96 static std::shared_ptr<CustomContextMenuItem> cast(
97 std::shared_ptr<ContextMenuItem> item);
98 static std::shared_ptr<CustomContextMenuItem> fromId(int32_t
id);
101 CustomContextMenuItemAction action,
102 bool enabled =
true);
105 std::string title()
const;
106 bool isEnabled()
const;
107 CustomContextMenuItemAction action()
const;
112 CustomContextMenuItemAction action,
113 bool enabled =
true);
118 bool enabled_ =
true;
119 CustomContextMenuItemAction action_ =
nullptr;
122enum class StandardContextMenuItemCommandId {
173 static std::shared_ptr<StandardContextMenuItem> create(
174 StandardContextMenuItemCommandId
id);
175 static std::shared_ptr<StandardContextMenuItem> cast(
176 std::shared_ptr<ContextMenuItem> item);
180 StandardContextMenuItemCommandId commandId()
const;
183 StandardContextMenuItemCommandId command_id_;
186namespace context_menu {
188std::shared_ptr<SeparatorContextMenuItem> Separator();
189std::shared_ptr<CustomContextMenu>
Menu(std::string title,
190 ContextMenuItems items);
191std::shared_ptr<CustomContextMenu>
Menu(ContextMenuItems items);
192std::shared_ptr<CustomContextMenuItem> Item(std::string title,
193 CustomContextMenuItemAction action,
194 bool enabled =
true);
196std::shared_ptr<StandardContextMenuItem> GoBack();
197std::shared_ptr<StandardContextMenuItem> GoForward();
198std::shared_ptr<StandardContextMenuItem> Reload();
199std::shared_ptr<StandardContextMenuItem> SavePageAs();
200std::shared_ptr<StandardContextMenuItem> Print();
201std::shared_ptr<StandardContextMenuItem> ExitFullScreen();
202std::shared_ptr<StandardContextMenuItem> InspectElement();
204std::shared_ptr<StandardContextMenuItem> SaveLinkAs();
205std::shared_ptr<StandardContextMenuItem> CopyLinkAddress();
206std::shared_ptr<StandardContextMenuItem> CopyEmailAddress();
208std::shared_ptr<StandardContextMenuItem> SaveImageAs();
209std::shared_ptr<StandardContextMenuItem> CopyImageAddress();
210std::shared_ptr<StandardContextMenuItem> CopyImage();
212std::shared_ptr<StandardContextMenuItem> SaveAudioAs();
213std::shared_ptr<StandardContextMenuItem> CopyAudioLocation();
215std::shared_ptr<StandardContextMenuItem> SaveVideoAs();
216std::shared_ptr<StandardContextMenuItem> CopyVideoLocation();
217std::shared_ptr<StandardContextMenuItem> PictureInPicture();
219std::shared_ptr<StandardContextMenuItem> Loop();
220std::shared_ptr<StandardContextMenuItem> Controls();
221std::shared_ptr<StandardContextMenuItem> RotateCW();
222std::shared_ptr<StandardContextMenuItem> RotateCCW();
224std::shared_ptr<StandardContextMenuItem> ReloadFrame();
225std::shared_ptr<StandardContextMenuItem> ViewFrameSource();
227std::shared_ptr<StandardContextMenuItem> Undo();
228std::shared_ptr<StandardContextMenuItem> Redo();
229std::shared_ptr<StandardContextMenuItem> Cut();
230std::shared_ptr<StandardContextMenuItem> Copy();
231std::shared_ptr<StandardContextMenuItem> Paste();
232std::shared_ptr<StandardContextMenuItem> PasteAndMatchStyle();
233std::shared_ptr<StandardContextMenuItem> SelectAll();
Definition context_menu.hpp:171