elm genlist: Fixed a bug with decorate all mode + tree effect. Delete tree effect...
[framework/uifw/elementary.git] / src / lib / elc_ctxpopup.h
1 /**
2  * @defgroup Ctxpopup Ctxpopup
3  * @ingroup Elementary
4  *
5  * @image html img/widget/ctxpopup/preview-00.png
6  * @image latex img/widget/ctxpopup/preview-00.eps
7  *
8  * @brief Context popup widget.
9  *
10  * A ctxpopup is a widget that, when shown, pops up a list of items.
11  * It automatically chooses an area inside its parent object's view
12  * (set via elm_ctxpopup_add() and elm_ctxpopup_hover_parent_set()) to
13  * optimally fit into it. In the default theme, it will also point an
14  * arrow to it's top left position at the time one shows it. Ctxpopup
15  * items have a label and/or an icon. It is intended for a small
16  * number of items (hence the use of list, not genlist).
17  *
18  * @note Ctxpopup is a specialization of @ref Hover.
19  *
20  * Signals that you can add callbacks for are:
21  * "dismissed" - the ctxpopup was dismissed
22  *
23  * Default content parts of the ctxpopup widget that you can use for are:
24  * @li "default" - A content of the ctxpopup
25  *
26  * Default content parts of the ctxpopup items that you can use for are:
27  * @li "icon" - An icon in the title area
28  *
29  * Default text parts of the ctxpopup items that you can use for are:
30  * @li "default" - Title label in the title area
31  *
32  * Supported elm_object common APIs.
33  * @li @ref elm_object_disabled_set
34  * @li @ref elm_object_disabled_get
35  * @li @ref elm_object_part_content_set
36  * @li @ref elm_object_part_content_get
37  * @li @ref elm_object_part_content_unset
38  * @li @ref elm_object_signal_emit
39  * @li @ref elm_object_signal_callback_add
40  * @li @ref elm_object_signal_callback_del
41  *
42  * Supported elm_object_item common APIs.
43  * @li @ref elm_object_item_disabled_set
44  * @li @ref elm_object_item_disabled_get
45  * @li @ref elm_object_item_part_text_set
46  * @li @ref elm_object_item_part_text_get
47  * @li @ref elm_object_item_part_content_set
48  * @li @ref elm_object_item_part_content_get
49  * @li @ref elm_object_item_signal_emit
50  *
51  * @ref tutorial_ctxpopup shows the usage of a good deal of the API.
52  * @{
53  */
54
55 typedef enum
56 {
57    ELM_CTXPOPUP_DIRECTION_DOWN, /**< ctxpopup show appear below clicked area */
58    ELM_CTXPOPUP_DIRECTION_RIGHT, /**< ctxpopup show appear to the right of the clicked area */
59    ELM_CTXPOPUP_DIRECTION_LEFT, /**< ctxpopup show appear to the left of the clicked area */
60    ELM_CTXPOPUP_DIRECTION_UP, /**< ctxpopup show appear above the clicked area */
61    ELM_CTXPOPUP_DIRECTION_UNKNOWN, /**< ctxpopup does not determine it's direction yet*/
62 } Elm_Ctxpopup_Direction; /**< Direction in which to show the popup */
63
64 /**
65  * @brief Add a new Ctxpopup object to the parent.
66  *
67  * @param parent Parent object
68  * @return New object or @c NULL, if it cannot be created
69  *
70  * @ingroup Ctxpopup
71  */
72 EAPI Evas_Object                 *elm_ctxpopup_add(Evas_Object *parent);
73
74 /**
75  * @brief Set the Ctxpopup's parent
76  *
77  * @param obj The ctxpopup object
78  * @param parent The parent to use
79  *
80  * Set the parent object.
81  *
82  * @note elm_ctxpopup_add() will automatically call this function
83  * with its @c parent argument.
84  *
85  * @see elm_ctxpopup_add()
86  * @see elm_hover_parent_set()
87  *
88  * @ingroup Ctxpopup
89  */
90 EAPI void                         elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
91
92 /**
93  * @brief Get the Ctxpopup's parent
94  *
95  * @param obj The ctxpopup object
96  *
97  * @see elm_ctxpopup_hover_parent_set() for more information
98  *
99  * @ingroup Ctxpopup
100  */
101 EAPI Evas_Object                 *elm_ctxpopup_hover_parent_get(const Evas_Object *obj);
102
103 /**
104  * @brief Clear all items in the given ctxpopup object.
105  *
106  * @param obj Ctxpopup object
107  *
108  * @ingroup Ctxpopup
109  */
110 EAPI void                         elm_ctxpopup_clear(Evas_Object *obj);
111
112 /**
113  * @brief Change the ctxpopup's orientation to horizontal or vertical.
114  *
115  * @param obj Ctxpopup object
116  * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical
117  *
118  * @ingroup Ctxpopup
119  */
120 EAPI void                         elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
121
122 /**
123  * @brief Get the value of current ctxpopup object's orientation.
124  *
125  * @param obj Ctxpopup object
126  * @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors)
127  *
128  * @see elm_ctxpopup_horizontal_set()
129  *
130  * @ingroup Ctxpopup
131  */
132 EAPI Eina_Bool                    elm_ctxpopup_horizontal_get(const Evas_Object *obj);
133
134 /**
135  * @brief Add a new item to a ctxpopup object.
136  *
137  * @param obj Ctxpopup object
138  * @param icon Icon to be set on new item
139  * @param label The Label of the new item
140  * @param func Convenience function called when item selected
141  * @param data Data passed to @p func
142  * @return A handle to the item added or @c NULL, on errors
143  *
144  * @warning Ctxpopup can't hold both an item list and a content at the same
145  * time. When an item is added, any previous content will be removed.
146  *
147  * @see elm_object_content_set()
148  *
149  * @ingroup Ctxpopup
150  */
151 EAPI Elm_Object_Item             *elm_ctxpopup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
152
153 /**
154  * @brief Set the direction priority of a ctxpopup.
155  *
156  * @param obj Ctxpopup object
157  * @param first 1st priority of direction
158  * @param second 2nd priority of direction
159  * @param third 3th priority of direction
160  * @param fourth 4th priority of direction
161  *
162  * This functions gives a chance to user to set the priority of ctxpopup
163  * showing direction. This doesn't guarantee the ctxpopup will appear in the
164  * requested direction.
165  *
166  * @see Elm_Ctxpopup_Direction
167  *
168  * @ingroup Ctxpopup
169  */
170 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);
171
172 /**
173  * @brief Get the direction priority of a ctxpopup.
174  *
175  * @param obj Ctxpopup object
176  * @param first 1st priority of direction to be returned
177  * @param second 2nd priority of direction to be returned
178  * @param third 3th priority of direction to be returned
179  * @param fourth 4th priority of direction to be returned
180  *
181  * @see elm_ctxpopup_direction_priority_set() for more information.
182  *
183  * @ingroup Ctxpopup
184  */
185 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);
186
187 /**
188  * @brief Get the current direction of a ctxpopup.
189  *
190  * @param obj Ctxpopup object
191  * @return current direction of a ctxpopup
192  *
193  * @warning Once the ctxpopup showed up, the direction would be determined
194  *
195  * @ingroup Ctxpopup
196  */
197 EAPI Elm_Ctxpopup_Direction       elm_ctxpopup_direction_get(const Evas_Object *obj);
198
199 /**
200  * @brief Dismiss a ctxpopup object
201  *
202  * @param obj The ctxpopup object
203  * Use this function to simulate clicking outside the ctxpopup to dismiss it.
204  * In this way, the ctxpopup will be hidden and the "clicked" signal will be
205  * emitted.
206  */
207 EAPI void                         elm_ctxpopup_dismiss(Evas_Object *obj);
208
209 /**
210  * @}
211  */