1 #ifndef DALI_WEB_ENGINE_CONTEXT_MENU_H
2 #define DALI_WEB_ENGINE_CONTEXT_MENU_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
23 #include <dali/public-api/math/vector2.h>
31 * @brief A class WebEngineContextMenu for context menu of web engine.
33 class WebEngineContextMenu
39 WebEngineContextMenu() = default;
44 virtual ~WebEngineContextMenu() = default;
47 * @brief Count the number of the context menu item.
49 * @return The number of current context menu item
51 virtual uint32_t GetItemCount() const = 0;
54 * @brief Return the nth item in a context menu.
56 * @param[in] index The number of the item
58 * @return The nth item of context menu
60 virtual std::unique_ptr<WebEngineContextMenuItem> GetItemAt(uint32_t index) const = 0;
63 * @brief Get the list of items.
65 * @return item list of context menu
67 virtual std::vector<std::unique_ptr<WebEngineContextMenuItem>> GetItemList() const = 0;
70 * @brief Get position of the context menu.
72 * @return position of context menu.
74 virtual Dali::Vector2 GetPosition() const = 0;
77 * @brief Remove the item from the context menu.
79 * @param[in] item The context menu item to be removed
81 * @return true if succeeded, false otherwise
83 virtual bool RemoveItem(WebEngineContextMenuItem& item) = 0;
86 * @brief Add the item to the context menu.
88 * @param[in] tag The tag of context menu item
89 * @param[in] title The title of context menu item
90 * @param[in] enabled If true the context menu item is enabled, false otherwise
92 * @return true if succeeded, false otherwise
94 virtual bool AppendItemAsAction(WebEngineContextMenuItem::ItemTag tag, const std::string& title, bool enabled) = 0;
97 * @brief Add the item to the context menu.
99 * @param[in] tag The tag of context menu item
100 * @param[in] title The title of context menu item
101 * @param[in] iconFile The path of icon to be set on context menu item
102 * @param[in] enabled If true the context menu item is enabled, false otherwise
104 * @return true if succeeded, false otherwise
106 virtual bool AppendItem(WebEngineContextMenuItem::ItemTag tag, const std::string& title, const std::string& iconFile, bool enabled) = 0;
109 * @brief Select the item from the context menu.
111 * @return true if succeeded, false otherwise
113 virtual bool SelectItem(WebEngineContextMenuItem& item) = 0;
116 * @brief Hide the context menu.
118 * @return true if succeeded, false otherwise
120 virtual bool Hide() = 0;
125 #endif // DALI_WEB_ENGINE_CONTEXT_MENU_H