2 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * @file ewk_context_menu_item.h
28 * @brief Describes the Ewk Context Menu Item API.
31 #ifndef ewk_context_menu_item_h
32 #define ewk_context_menu_item_h
34 #include "ewk_defines.h"
42 * \enum Ewk_Context_Menu_Item_Type
43 * @brief Defines the types of the items for the context menu.
44 * @info Keep this in sync with ContextMenuItem.h
48 EWK_CHECKABLE_ACTION_TYPE,
51 } Ewk_Context_Menu_Item_Type;
54 * \enum Ewk_Context_Menu_Action
55 * @brief Provides the actions of items for the context menu.
56 * @info Keep this in sync with ContextMenuItem.h
59 EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION,
60 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW,
61 EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK,
62 EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD,
63 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW,
64 EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK,
65 EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD,
66 EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD,
67 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW,
68 EWK_CONTEXT_MENU_ITEM_TAG_COPY,
69 EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK,
70 EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD,
71 EWK_CONTEXT_MENU_ITEM_TAG_STOP,
72 EWK_CONTEXT_MENU_ITEM_TAG_RELOAD,
73 EWK_CONTEXT_MENU_ITEM_TAG_CUT,
74 EWK_CONTEXT_MENU_ITEM_TAG_PASTE,
75 EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL,
76 EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS,
77 EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND,
78 EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING,
79 EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING,
80 EWK_CONTEXT_MENU_ITEM_TAG_OTHER,
81 EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT,
82 EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB,
83 EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY,
84 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION,
85 EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE,
86 EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN,
87 EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT,
88 EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE,
89 EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE,
90 EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES,
91 EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS,
92 EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE,
93 EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE,
94 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK = 2000,
95 EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR,
96 EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, /**< spelling or spelling/grammar sub-menu */
97 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL,
98 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING,
99 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING,
100 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING,
101 EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, /**< font sub-menu */
102 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS,
103 EWK_CONTEXT_MENU_ITEM_TAG_BOLD,
104 EWK_CONTEXT_MENU_ITEM_TAG_ITALIC,
105 EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE,
106 EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE,
107 EWK_CONTEXT_MENU_ITEM_TAG_STYLES,
108 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS,
109 EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, /**< speech sub-menu */
110 EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING,
111 EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING,
112 EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, /**< writing direction sub-menu */
113 EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION,
114 EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT,
115 EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT,
116 EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING,
117 EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING,
118 EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT,
119 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, /**< text direction sub-menu */
120 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT,
121 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
122 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
123 EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
124 EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
125 EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
126 EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
127 EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
128 EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
129 EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
130 EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG = 5000,
131 EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION = 5998,
132 EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG = 5999,
133 EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
134 } Ewk_Context_Menu_Item_Action;
137 * Creates a new item of the context menu.
139 * @param type specifies a type of the item
140 * @param action specifies a action of the item
141 * @param title specifies a title of the item
142 * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
143 * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
144 * @return the pointer to the new item
146 * @see ewk_context_menu_item_new_with_submenu
148 EAPI Ewk_Context_Menu_Item *ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char *title, Eina_Bool checked, Eina_Bool enabled);
151 * Creates a new item of the context menu.
153 * @param type specifies a type of the item
154 * @param action specifies a action of the item
155 * @param title specifies a title of the item
156 * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
157 * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
158 * @param submenu specifies a submenu of the item
159 * @return the pointer to the new item
161 * @see ewk_context_menu_item_new
163 EAPI Ewk_Context_Menu_Item *ewk_context_menu_item_new_with_submenu(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char *title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu *submenu);
166 * Gets type of the item.
168 * @param o the item to get the type
169 * @return type of the item on success or @c EWK_ACTION_TYPE on failure
171 * @see ewk_context_menu_item_type_set
173 EAPI Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(const Ewk_Context_Menu_Item *o);
176 * Sets the type of item.
178 * @param o the item to set the type
179 * @param type a new type for the item object
180 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
182 * @see ewk_context_menu_item_type_get
184 EAPI Eina_Bool ewk_context_menu_item_type_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Type type);
187 * Gets an action of the item.
189 * @param o the item to get the action
190 * @return an action of the item on success or @c EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION on failure
192 * @see ewk_context_menu_item_action_set
194 EAPI Ewk_Context_Menu_Item_Action ewk_context_menu_item_action_get(const Ewk_Context_Menu_Item *o);
197 * Sets an action of the item.
199 * @param o the item to set the action
200 * @param action a new action for the item object
201 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
203 * @see ewk_context_menu_item_action_get
205 EAPI Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Action action);
208 * Gets a title of the item.
210 * @param o the item to get the title
211 * @return a title of the item on success, or @c NULL on failure
213 * @see ewk_context_menu_item_title_set
215 EAPI const char *ewk_context_menu_item_title_get(const Ewk_Context_Menu_Item *o);
218 * Sets a title of the item.
220 * @param o the item to set the title
221 * @param title a new title for the item object
222 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
224 * @see ewk_context_menu_item_title_get
226 EAPI Eina_Bool ewk_context_menu_item_title_set(Ewk_Context_Menu_Item *o, const char *title);
229 * Queries if the item is toggled.
231 * @param o the item to query if the item is toggled
232 * @return @c EINA_TRUE if the item is toggled or @c EINA_FALSE if not or on failure
234 EAPI Eina_Bool ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item *o);
237 * Sets if the item should be toggled.
239 * @param o the item to be toggled
240 * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
241 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
243 EAPI Eina_Bool ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item *o, Eina_Bool checked);
246 * Gets if the item is enabled.
248 * @param o the item to get enabled state
249 * @return @c EINA_TRUE if it's enabled, @c EINA_FALSE if not or on failure
251 * @see ewk_context_menu_item_enabled_set
253 EAPI Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item *o);
256 * Enables/disables the item.
258 * @param o the item to enable/disable
259 * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
260 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
262 * @see ewk_context_menu_item_enabled_get
264 EAPI Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item *o, Eina_Bool enabled);
270 #endif /* ewk_context_menu_item_h */