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 WKContextMenuItemTypes.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.
58 EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION,
59 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW,
60 EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK,
61 EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD,
62 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW,
63 EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK,
64 EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD,
65 EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD,
66 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW,
67 EWK_CONTEXT_MENU_ITEM_TAG_COPY,
68 EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK,
69 EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD,
70 EWK_CONTEXT_MENU_ITEM_TAG_STOP,
71 EWK_CONTEXT_MENU_ITEM_TAG_RELOAD,
72 EWK_CONTEXT_MENU_ITEM_TAG_CUT,
73 EWK_CONTEXT_MENU_ITEM_TAG_PASTE,
74 EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL,
75 EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS,
76 EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND,
77 EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING,
78 EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING,
79 EWK_CONTEXT_MENU_ITEM_TAG_OTHER,
80 EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT,
81 EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB,
82 EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY,
83 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION,
84 EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE,
85 EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN,
86 EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT,
87 EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE,
88 EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE,
89 EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES,
90 EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS,
91 EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE,
92 EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE,
93 EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK = 2000,
94 EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR,
95 EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, /**< spelling or spelling/grammar sub-menu */
96 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL,
97 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING,
98 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING,
99 EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING,
100 EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, /**< font sub-menu */
101 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS,
102 EWK_CONTEXT_MENU_ITEM_TAG_BOLD,
103 EWK_CONTEXT_MENU_ITEM_TAG_ITALIC,
104 EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE,
105 EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE,
106 EWK_CONTEXT_MENU_ITEM_TAG_STYLES,
107 EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS,
108 EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, /**< speech sub-menu */
109 EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING,
110 EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING,
111 EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, /**< writing direction sub-menu */
112 EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION,
113 EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT,
114 EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT,
115 EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING,
116 EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING,
117 EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT,
118 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, /**< text direction sub-menu */
119 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT,
120 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
121 EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
122 EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
123 EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
124 EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
125 EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
126 EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
127 EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
128 EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
129 EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
130 } Ewk_Context_Menu_Item_Action;
133 * Creates a new item of the context menu.
135 * @param type specifies a type of the item
136 * @param action specifies a action of the item
137 * @param title specifies a title of the item
138 * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
139 * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
140 * @return the pointer to the new item
142 * @see ewk_context_menu_item_new_with_submenu
144 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);
147 * Creates a new item of the context menu.
149 * @param type specifies a type of the item
150 * @param action specifies a action of the item
151 * @param title specifies a title of the item
152 * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
153 * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
154 * @param submenu specifies a submenu of the item
155 * @return the pointer to the new item
157 * @see ewk_context_menu_item_new
159 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);
162 * Gets type of the item.
164 * @param o the item to get the type
165 * @return type of the item on success or @c EWK_ACTION_TYPE on failure
167 * @see ewk_context_menu_item_type_set
169 EAPI Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(const Ewk_Context_Menu_Item *o);
172 * Sets the type of item.
174 * @param o the item to set the type
175 * @param type a new type for the item object
176 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
178 * @see ewk_context_menu_item_type_get
180 EAPI Eina_Bool ewk_context_menu_item_type_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Type type);
183 * Gets an action of the item.
185 * @param o the item to get the action
186 * @return an action of the item on success or @c EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION on failure
188 * @see ewk_context_menu_item_action_set
190 EAPI Ewk_Context_Menu_Item_Action ewk_context_menu_item_action_get(const Ewk_Context_Menu_Item *o);
193 * Sets an action of the item.
195 * @param o the item to set the action
196 * @param action a new action for the item object
197 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
199 * @see ewk_context_menu_item_action_get
201 EAPI Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Action action);
204 * Gets a title of the item.
206 * @param o the item to get the title
207 * @return a title of the item on success, or @c NULL on failure
209 * @see ewk_context_menu_item_title_set
211 EAPI const char *ewk_context_menu_item_title_get(const Ewk_Context_Menu_Item *o);
214 * Sets a title of the item.
216 * @param o the item to set the title
217 * @param title a new title for the item object
218 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
220 * @see ewk_context_menu_item_title_get
222 EAPI Eina_Bool ewk_context_menu_item_title_set(Ewk_Context_Menu_Item *o, const char *title);
225 * Queries if the item is toggled.
227 * @param o the item to query if the item is toggled
228 * @return @c EINA_TRUE if the item is toggled or @c EINA_FALSE if not or on failure
230 EAPI Eina_Bool ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item *o);
233 * Sets if the item should be toggled.
235 * @param o the item to be toggled
236 * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
237 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
239 EAPI Eina_Bool ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item *o, Eina_Bool checked);
242 * Gets if the item is enabled.
244 * @param o the item to get enabled state
245 * @return @c EINA_TRUE if it's enabled, @c EINA_FALSE if not or on failure
247 * @see ewk_context_menu_item_enabled_set
249 EAPI Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item *o);
252 * Enables/disables the item.
254 * @param o the item to enable/disable
255 * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
256 * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
258 * @see ewk_context_menu_item_enabled_get
260 EAPI Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item *o, Eina_Bool enabled);
266 #endif /* ewk_context_menu_item_h */