doc warning fix.
[framework/uifw/elementary.git] / src / lib / elc_ctxpopup.h
1 /**
2  * @defgroup Ctxpopup Ctxpopup
3  *
4  * @image html img/widget/ctxpopup/preview-00.png
5  * @image latex img/widget/ctxpopup/preview-00.eps
6  *
7  * @brief Context popup widet.
8  *
9  * A ctxpopup is a widget that, when shown, pops up a list of items.
10  * It automatically chooses an area inside its parent object's view
11  * (set via elm_ctxpopup_add() and elm_ctxpopup_hover_parent_set()) to
12  * optimally fit into it. In the default theme, it will also point an
13  * arrow to it's top left position at the time one shows it. Ctxpopup
14  * items have a label and/or an icon. It is intended for a small
15  * number of items (hence the use of list, not genlist).
16  *
17  * @note Ctxpopup is a especialization of @ref Hover.
18  *
19  * Signals that you can add callbacks for are:
20  * "dismissed" - the ctxpopup was dismissed
21  *
22  * Default contents parts of the ctxpopup widget that you can use for are:
23  * @li "default" - A content of the ctxpopup
24  *
25  * Default contents parts of the ctxpopup items that you can use for are:
26  * @li "icon" - An icon in the title area
27  *
28  * Default text parts of the ctxpopup items that you can use for are:
29  * @li "default" - Title label in the title area
30  *
31  * @ref tutorial_ctxpopup shows the usage of a good deal of the API.
32  * @{
33  */
34
35 typedef enum _Elm_Ctxpopup_Direction
36 {
37    ELM_CTXPOPUP_DIRECTION_DOWN, /**< ctxpopup show appear below clicked area */
38    ELM_CTXPOPUP_DIRECTION_RIGHT, /**< ctxpopup show appear to the right of the clicked area */
39    ELM_CTXPOPUP_DIRECTION_LEFT, /**< ctxpopup show appear to the left of the clicked area */
40    ELM_CTXPOPUP_DIRECTION_UP, /**< ctxpopup show appear above the clicked area */
41    ELM_CTXPOPUP_DIRECTION_UNKNOWN, /**< ctxpopup does not determine it's direction yet*/
42 } Elm_Ctxpopup_Direction; /**< Direction in which to show the popup */
43
44 /**
45  * @brief Add a new Ctxpopup object to the parent.
46  *
47  * @param parent Parent object
48  * @return New object or @c NULL, if it cannot be created
49  *
50  * @ingroup Ctxpopup
51  */
52 EAPI Evas_Object *
53                                   elm_ctxpopup_add(Evas_Object *parent)
54 EINA_ARG_NONNULL(1);
55
56 /**
57  * @brief Set the Ctxpopup's parent
58  *
59  * @param obj The ctxpopup object
60  * @param parent The parent to use
61  *
62  * Set the parent object.
63  *
64  * @note elm_ctxpopup_add() will automatically call this function
65  * with its @c parent argument.
66  *
67  * @see elm_ctxpopup_add()
68  * @see elm_hover_parent_set()
69  *
70  * @ingroup Ctxpopup
71  */
72 EAPI void                         elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1, 2);
73
74 /**
75  * @brief Get the Ctxpopup's parent
76  *
77  * @param obj The ctxpopup object
78  *
79  * @see elm_ctxpopup_hover_parent_set() for more information
80  *
81  * @ingroup Ctxpopup
82  */
83 EAPI Evas_Object                 *elm_ctxpopup_hover_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
84
85 /**
86  * @brief Clear all items in the given ctxpopup object.
87  *
88  * @param obj Ctxpopup object
89  *
90  * @ingroup Ctxpopup
91  */
92 EAPI void                         elm_ctxpopup_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
93
94 /**
95  * @brief Change the ctxpopup's orientation to horizontal or vertical.
96  *
97  * @param obj Ctxpopup object
98  * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical
99  *
100  * @ingroup Ctxpopup
101  */
102 EAPI void                         elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) EINA_ARG_NONNULL(1);
103
104 /**
105  * @brief Get the value of current ctxpopup object's orientation.
106  *
107  * @param obj Ctxpopup object
108  * @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors)
109  *
110  * @see elm_ctxpopup_horizontal_set()
111  *
112  * @ingroup Ctxpopup
113  */
114 EAPI Eina_Bool                    elm_ctxpopup_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
115
116 /**
117  * @brief Add a new item to a ctxpopup object.
118  *
119  * @param obj Ctxpopup object
120  * @param icon Icon to be set on new item
121  * @param label The Label of the new item
122  * @param func Convenience function called when item selected
123  * @param data Data passed to @p func
124  * @return A handle to the item added or @c NULL, on errors
125  *
126  * @warning Ctxpopup can't hold both an item list and a content at the same
127  * time. When an item is added, any previous content will be removed.
128  *
129  * @see elm_ctxpopup_content_set()
130  *
131  * @ingroup Ctxpopup
132  */
133 Elm_Object_Item                  *elm_ctxpopup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
134
135 /**
136  * @brief Delete the given item in a ctxpopup object.
137  *
138  * @param it Ctxpopup item to be deleted
139  *
140  * @see elm_ctxpopup_item_append()
141  *
142  * @ingroup Ctxpopup
143  */
144 EAPI void                         elm_ctxpopup_item_del(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
145
146 /**
147  * @brief Set the ctxpopup item's state as disabled or enabled.
148  *
149  * @param it Ctxpopup item to be enabled/disabled
150  * @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
151  *
152  * When disabled the item is greyed out to indicate it's state.
153  * @deprecated use elm_object_item_disabled_set() instead
154  *
155  * @ingroup Ctxpopup
156  */
157 EINA_DEPRECATED EAPI void         elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1);
158
159 /**
160  * @brief Get the ctxpopup item's disabled/enabled state.
161  *
162  * @param it Ctxpopup item to be enabled/disabled
163  * @return disabled @c EINA_TRUE, if disabled, @c EINA_FALSE otherwise
164  *
165  * @see elm_ctxpopup_item_disabled_set()
166  * @deprecated use elm_object_item_disabled_get() instead
167  *
168  * @ingroup Ctxpopup
169  */
170 EAPI Eina_Bool                    elm_ctxpopup_item_disabled_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
171
172 /**
173  * @brief Get the icon object for the given ctxpopup item.
174  *
175  * @param it Ctxpopup item
176  * @return icon object or @c NULL, if the item does not have icon or an error
177  * occurred
178  *
179  * @see elm_ctxpopup_item_append()
180  * @see elm_ctxpopup_item_icon_set()
181  *
182  * @deprecated use elm_object_item_part_content_get() instead
183  *
184  * @ingroup Ctxpopup
185  */
186 EINA_DEPRECATED EAPI Evas_Object *elm_ctxpopup_item_icon_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
187
188 /**
189  * @brief Sets the side icon associated with the ctxpopup item
190  *
191  * @param it Ctxpopup item
192  * @param icon Icon object to be set
193  *
194  * Once the icon object is set, a previously set one will be deleted.
195  * @warning Setting the same icon for two items will cause the icon to
196  * dissapear from the first item.
197  *
198  * @see elm_ctxpopup_item_append()
199  *
200  * @deprecated use elm_object_item_part_content_set() instead
201  *
202  * @ingroup Ctxpopup
203  */
204 EINA_DEPRECATED EAPI void         elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon) EINA_ARG_NONNULL(1);
205
206 /**
207  * @brief Get the label for the given ctxpopup item.
208  *
209  * @param it Ctxpopup item
210  * @return label string or @c NULL, if the item does not have label or an
211  * error occured
212  *
213  * @see elm_ctxpopup_item_append()
214  * @see elm_ctxpopup_item_label_set()
215  *
216  * @deprecated use elm_object_item_text_get() instead
217  *
218  * @ingroup Ctxpopup
219  */
220 EINA_DEPRECATED EAPI const char  *elm_ctxpopup_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
221
222 /**
223  * @brief (Re)set the label on the given ctxpopup item.
224  *
225  * @param it Ctxpopup item
226  * @param label String to set as label
227  *
228  * @deprecated use elm_object_item_text_set() instead
229  *
230  * @ingroup Ctxpopup
231  */
232 EINA_DEPRECATED EAPI void         elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
233
234 /**
235  * @brief Set an elm widget as the content of the ctxpopup.
236  *
237  * @param obj Ctxpopup object
238  * @param content Content to be swallowed
239  *
240  * If the content object is already set, a previous one will bedeleted. If
241  * you want to keep that old content object, use the
242  * elm_ctxpopup_content_unset() function.
243  *
244  * @warning Ctxpopup can't hold both a item list and a content at the same
245  * time. When a content is set, any previous items will be removed.
246  *
247  * @deprecated use elm_object_content_set() instead
248  *
249  * @ingroup Ctxpopup
250  */
251 EINA_DEPRECATED EAPI void         elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1, 2);
252
253 /**
254  * @brief Unset the ctxpopup content
255  *
256  * @param obj Ctxpopup object
257  * @return The content that was being used
258  *
259  * Unparent and return the content object which was set for this widget.
260  *
261  * @deprecated use elm_object_content_unset()
262  *
263  * @see elm_ctxpopup_content_set()
264  *
265  * @deprecated use elm_object_content_unset() instead
266  *
267  * @ingroup Ctxpopup
268  */
269 EINA_DEPRECATED EAPI Evas_Object *elm_ctxpopup_content_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
270
271 /**
272  * @brief Set the direction priority of a ctxpopup.
273  *
274  * @param obj Ctxpopup object
275  * @param first 1st priority of direction
276  * @param second 2nd priority of direction
277  * @param third 3th priority of direction
278  * @param fourth 4th priority of direction
279  *
280  * This functions gives a chance to user to set the priority of ctxpopup
281  * showing direction. This doesn't guarantee the ctxpopup will appear in the
282  * requested direction.
283  *
284  * @see Elm_Ctxpopup_Direction
285  *
286  * @ingroup Ctxpopup
287  */
288 EAPI void                         elm_ctxpopup_direction_priority_set(Evas_Object *obj, Elm_Ctxpopup_Direction first, Elm_Ctxpopup_Direction second, Elm_Ctxpopup_Direction third, Elm_Ctxpopup_Direction fourth) EINA_ARG_NONNULL(1);
289
290 /**
291  * @brief Get the direction priority of a ctxpopup.
292  *
293  * @param obj Ctxpopup object
294  * @param first 1st priority of direction to be returned
295  * @param second 2nd priority of direction to be returned
296  * @param third 3th priority of direction to be returned
297  * @param fourth 4th priority of direction to be returned
298  *
299  * @see elm_ctxpopup_direction_priority_set() for more information.
300  *
301  * @ingroup Ctxpopup
302  */
303 EAPI void                         elm_ctxpopup_direction_priority_get(Evas_Object *obj, Elm_Ctxpopup_Direction *first, Elm_Ctxpopup_Direction *second, Elm_Ctxpopup_Direction *third, Elm_Ctxpopup_Direction *fourth) EINA_ARG_NONNULL(1);
304
305 /**
306  * @brief Get the current direction of a ctxpopup.
307  *
308  * @param obj Ctxpopup object
309  * @return current direction of a ctxpopup
310  *
311  * @warning Once the ctxpopup showed up, the direction would be determined
312  *
313  * @ingroup Ctxpopup
314  */
315 EAPI Elm_Ctxpopup_Direction       elm_ctxpopup_direction_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
316
317 /**
318  * @}
319  */