2 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
22 * @file ewk_context_menu.h
23 * @brief Describes the context menu API.
26 #ifndef ewk_context_menu_h
27 #define ewk_context_menu_h
37 * \enum Ewk_Context_Menu_Item_Tag
38 * @brief Provides the tags of items for the context menu.
39 * @info Keep this in sync with WKContextMenuItemTypes.h
42 EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION = 0,
43 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW,
44 EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK,
45 EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD,
46 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW,
47 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_CURRENT_WINDOW,
48 EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK,
49 EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD,
50 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW,
51 EWK_CONTEXT_MENU_ITEM_TAG_COPY,
52 EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK,
53 EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD,
54 EWK_CONTEXT_MENU_ITEM_TAG_STOP,
55 EWK_CONTEXT_MENU_ITEM_TAG_SHARE_LINK,
56 EWK_CONTEXT_MENU_ITEM_TAG_RELOAD,
57 EWK_CONTEXT_MENU_ITEM_TAG_CUT,
58 EWK_CONTEXT_MENU_ITEM_TAG_PASTE,
59 EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS,
60 EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND,
61 EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING,
62 EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING,
63 EWK_CONTEXT_MENU_ITEM_TAG_OTHER,
64 EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT,
65 EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB,
66 EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY,
67 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION,
68 EWK_CONTEXT_MENU_ITEM_TAG_PDF_ACTUAL_SIZE,
69 EWK_CONTEXT_MENU_ITEM_TAG_PDF_ZOOM_IN,
70 EWK_CONTEXT_MENU_ITEM_TAG_PDF_ZOOM_OUT,
71 EWK_CONTEXT_MENU_ITEM_TAG_PDF_AUTO_SIZE,
72 EWK_CONTEXT_MENU_ITEM_TAG_PDF_SINGLE_PAGE,
73 EWK_CONTEXT_MENU_ITEM_TAG_PDF_FACTING_PAGES,
74 EWK_CONTEXT_MENU_ITEM_TAG_PDF_CONTINUOUS,
75 EWK_CONTEXT_MENU_ITEM_TAG_PDF_NEXT_PAGE,
76 EWK_CONTEXT_MENU_ITEM_TAG_PDF_PREVIOUS_PAGE,
77 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK,
78 EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR,
79 EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU,
80 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL,
81 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING,
82 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING,
83 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING,
84 EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU,
85 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS,
86 EWK_CONTEXT_MENU_ITEM_TAG_BOLD,
87 EWK_CONTEXT_MENU_ITEM_TAG_ITALIC,
88 EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE,
89 EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE,
90 EWK_CONTEXT_MENU_ITEM_TAG_STYLES,
91 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS,
92 EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU,
93 EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING,
94 EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING,
95 EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU,
96 EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION,
97 EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT,
98 EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT,
99 EWK_CONTEXT_MENU_ITEM_TAG_PDF_SINGLE_PAGE_SCROLLING,
100 EWK_CONTEXT_MENU_ITEM_TAG_PDF_FACING_PAGES_SCROLLING,
101 EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT,
102 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU,
103 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT,
104 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
105 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
106 EWK_CONTEXT_MENU_ITEM_TAG_CORRECT_SPELLING_AUTOMATICALLY,
107 EWK_CONTEXT_MENU_ITEM_TAG_SUBSTITUTIONS_MENU,
108 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SUBSTITUTIONS,
109 EWK_CONTEXT_MENU_ITEM_TAG_SMART_COPY_PASTE,
110 EWK_CONTEXT_MENU_ITEM_TAG_SMART_QUOTES,
111 EWK_CONTEXT_MENU_ITEM_TAG_SMART_DASHES,
112 EWK_CONTEXT_MENU_ITEM_TAG_SMART_LINKS,
113 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_REPLACEMENT,
114 EWK_CONTEXT_MENU_ITEM_TAG_TRANSFORMATIONS_MENU,
115 EWK_CONTEXT_MENU_ITEM_TAG_MAKE_UPPER_CASE,
116 EWK_CONTEXT_MENU_ITEM_TAG_MAKE_LOWER_CASE,
117 EWK_CONTEXT_MENU_ITEM_TAG_CAPITALIZE,
118 EWK_CONTEXT_MENU_ITEM_TAG_CHANGE_BACK,
119 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_MEDIA_IN_NEW_WINDOW,
120 EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
121 EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
122 EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
123 EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
124 EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
125 EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
126 EWK_CONTEXT_MENU_ITEM_TAG_DICTATION_ALTERNATIVE,
127 EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL,
128 EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD,
129 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_SELECTION_MODE,
130 EWK_CONTEXT_MENU_ITEM_TAG_CLIPBOARD,
131 EWK_CONTEXT_MENU_ITEM_TAG_DRAG,
132 EWK_CONTEXT_MENU_ITEM_TAG_TRANSLATE,
133 EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_DATA,
134 EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
136 /** Creates a type name for Ewk_Context_Menu_Item_Tag */
137 typedef uint32_t Ewk_Context_Menu_Item_Tag;
140 * \enum _Ewk_Context_Menu_Item_Type
141 * @brief Defines the types of the items for the context menu.
142 * @info Keep this in sync with WKContextMenuItemTypes.h
144 enum _Ewk_Context_Menu_Item_Type {
145 EWK_CONTEXT_MENU_ITEM_TYPE_ACTION,
146 EWK_CONTEXT_MENU_ITEM_TYPE_CHECKABLE_ACTION,
147 EWK_CONTEXT_MENU_ITEM_TYPE_SEPARATOR,
148 EWK_CONTEXT_MENU_ITEM_TYPE_SUBMENU
150 /** Creates a type name for _Ewk_Context_Menu_Item_Type */
151 typedef enum _Ewk_Context_Menu_Item_Type Ewk_Context_Menu_Item_Type;
153 /** Creates a type name for _Ewk_Context_Menu */
154 typedef struct _Ewk_Context_Menu Ewk_Context_Menu;
156 /** Creates a type name for _Ewk_Context_Menu_Item */
157 typedef struct _Ewk_Context_Menu_Item Ewk_Context_Menu_Item;
160 * Counts the number of the context menu item.
162 * @param menu the context menu object
164 * @return number of current context menu item
166 EXPORT_API unsigned ewk_context_menu_item_count(Ewk_Context_Menu* menu);
169 * Returns the nth item in a context menu.
171 * @param menu The context menu object
172 * @param n The number of the item
174 * @return The nth item of context menu
176 EXPORT_API Ewk_Context_Menu_Item* ewk_context_menu_nth_item_get(Ewk_Context_Menu* menu, unsigned int n);
179 * Removes the context menu item from the context menu object.
181 * @param menu the context menu object
182 * @param item the context menu item to remove
184 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
186 EXPORT_API Eina_Bool ewk_context_menu_item_remove(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item);
189 * Adds the context menu item to the context menu object.
191 * @param menu the context menu object
192 * @param tag the tag of context menu item
193 * @param title the title of context menu item
194 * @param enabled the enabled of context menu item
196 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
198 EXPORT_API Eina_Bool ewk_context_menu_item_append_as_action(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item_Tag tag, const char* title, Eina_Bool enabled);
201 * Adds the context menu item to the context menu object.
203 * @param menu the context menu object
204 * @param tag the tag of context menu item
205 * @param title the title of context menu item
206 * @param icon_file the path of icon to be set on context menu item
207 * @param enabled the enabled of context menu item
209 * @return @c EINA_TRUE on successful request or @c EINA_FALSE on failure
211 EXPORT_API Eina_Bool ewk_context_menu_item_append(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item_Tag tag, const char* title, const char* icon_file, Eina_Bool enabled);
214 * Returns the tag of context menu item.
216 * @param item The context menu item object
218 * @return The tag of context menu item
220 EXPORT_API Ewk_Context_Menu_Item_Tag ewk_context_menu_item_tag_get(Ewk_Context_Menu_Item* item);
223 * Returns the type of context menu item.
225 * @param item The context menu item object
227 * @return The type of context menu item
229 EXPORT_API Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(Ewk_Context_Menu_Item* item);
232 * Returns the item is enabled.
234 * @param item The context menu item object to get enabled state
236 * @return EINA_TRUE if it is enabled, @c EINA_FALSE if not or on failure
238 EXPORT_API Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item* item);
241 * Returns the link url string of context menu item.
243 * @param menu the context menu item object
245 * @return current link url string on success or @c 0 on failure
247 EXPORT_API const char* ewk_context_menu_item_link_url_get(Ewk_Context_Menu_Item* item);
250 * Returns the image url string of context menu item.
252 * @param menu the context menu item object
254 * @return current image url string on success or @c 0 on failure
256 EXPORT_API const char* ewk_context_menu_item_image_url_get(Ewk_Context_Menu_Item* item);
262 #endif // ewk_context_menu_h