09e6b5e9d9233f5c74970ba4afeb57fde4a83a1f
[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  * Supported elm_object common APIs.
32  * @li elm_object_part_content_set
33  * @li elm_object_part_content_get
34  * @li elm_object_part_content_unset
35  *
36  * Supported elm_object_item common APIs.
37  * @li elm_object_item_disabled_set
38  * @li elm_object_item_disabled_get
39  * @li elm_object_item_part_text_set
40  * @li elm_object_item_part_text_get
41  * @li elm_object_item_part_content_set
42  * @li elm_object_item_part_content_get
43  * @li elm_object_item_signal_emit
44  *
45  * @ref tutorial_ctxpopup shows the usage of a good deal of the API.
46  * @{
47  */
48
49 typedef enum
50 {
51    ELM_CTXPOPUP_DIRECTION_DOWN, /**< ctxpopup show appear below clicked area */
52    ELM_CTXPOPUP_DIRECTION_RIGHT, /**< ctxpopup show appear to the right of the clicked area */
53    ELM_CTXPOPUP_DIRECTION_LEFT, /**< ctxpopup show appear to the left of the clicked area */
54    ELM_CTXPOPUP_DIRECTION_UP, /**< ctxpopup show appear above the clicked area */
55    ELM_CTXPOPUP_DIRECTION_UNKNOWN, /**< ctxpopup does not determine it's direction yet*/
56 } Elm_Ctxpopup_Direction; /**< Direction in which to show the popup */
57
58 /**
59  * @brief Add a new Ctxpopup object to the parent.
60  *
61  * @param parent Parent object
62  * @return New object or @c NULL, if it cannot be created
63  *
64  * @ingroup Ctxpopup
65  */
66 EAPI Evas_Object                 *elm_ctxpopup_add(Evas_Object *parent);
67
68 /**
69  * @brief Set the Ctxpopup's parent
70  *
71  * @param obj The ctxpopup object
72  * @param parent The parent to use
73  *
74  * Set the parent object.
75  *
76  * @note elm_ctxpopup_add() will automatically call this function
77  * with its @c parent argument.
78  *
79  * @see elm_ctxpopup_add()
80  * @see elm_hover_parent_set()
81  *
82  * @ingroup Ctxpopup
83  */
84 EAPI void                         elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
85
86 /**
87  * @brief Get the Ctxpopup's parent
88  *
89  * @param obj The ctxpopup object
90  *
91  * @see elm_ctxpopup_hover_parent_set() for more information
92  *
93  * @ingroup Ctxpopup
94  */
95 EAPI Evas_Object                 *elm_ctxpopup_hover_parent_get(const Evas_Object *obj);
96
97 /**
98  * @brief Clear all items in the given ctxpopup object.
99  *
100  * @param obj Ctxpopup object
101  *
102  * @ingroup Ctxpopup
103  */
104 EAPI void                         elm_ctxpopup_clear(Evas_Object *obj);
105
106 /**
107  * @brief Change the ctxpopup's orientation to horizontal or vertical.
108  *
109  * @param obj Ctxpopup object
110  * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical
111  *
112  * @ingroup Ctxpopup
113  */
114 EAPI void                         elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
115
116 /**
117  * @brief Get the value of current ctxpopup object's orientation.
118  *
119  * @param obj Ctxpopup object
120  * @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors)
121  *
122  * @see elm_ctxpopup_horizontal_set()
123  *
124  * @ingroup Ctxpopup
125  */
126 EAPI Eina_Bool                    elm_ctxpopup_horizontal_get(const Evas_Object *obj);
127
128 /**
129  * @brief Add a new item to a ctxpopup object.
130  *
131  * @param obj Ctxpopup object
132  * @param icon Icon to be set on new item
133  * @param label The Label of the new item
134  * @param func Convenience function called when item selected
135  * @param data Data passed to @p func
136  * @return A handle to the item added or @c NULL, on errors
137  *
138  * @warning Ctxpopup can't hold both an item list and a content at the same
139  * time. When an item is added, any previous content will be removed.
140  *
141  * @see elm_ctxpopup_content_set()
142  *
143  * @ingroup Ctxpopup
144  */
145 EAPI Elm_Object_Item             *elm_ctxpopup_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
146
147 /**
148  * @brief Delete the given item in a ctxpopup object.
149  *
150  * @param it Ctxpopup item to be deleted
151  *
152  * @see elm_ctxpopup_item_append()
153  *
154  * @ingroup Ctxpopup
155  */
156 EAPI void                         elm_ctxpopup_item_del(Elm_Object_Item *it);
157
158 /**
159  * @brief Set the direction priority of a ctxpopup.
160  *
161  * @param obj Ctxpopup object
162  * @param first 1st priority of direction
163  * @param second 2nd priority of direction
164  * @param third 3th priority of direction
165  * @param fourth 4th priority of direction
166  *
167  * This functions gives a chance to user to set the priority of ctxpopup
168  * showing direction. This doesn't guarantee the ctxpopup will appear in the
169  * requested direction.
170  *
171  * @see Elm_Ctxpopup_Direction
172  *
173  * @ingroup Ctxpopup
174  */
175 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);
176
177 /**
178  * @brief Get the direction priority of a ctxpopup.
179  *
180  * @param obj Ctxpopup object
181  * @param first 1st priority of direction to be returned
182  * @param second 2nd priority of direction to be returned
183  * @param third 3th priority of direction to be returned
184  * @param fourth 4th priority of direction to be returned
185  *
186  * @see elm_ctxpopup_direction_priority_set() for more information.
187  *
188  * @ingroup Ctxpopup
189  */
190 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);
191
192 /**
193  * @brief Get the current direction of a ctxpopup.
194  *
195  * @param obj Ctxpopup object
196  * @return current direction of a ctxpopup
197  *
198  * @warning Once the ctxpopup showed up, the direction would be determined
199  *
200  * @ingroup Ctxpopup
201  */
202 EAPI Elm_Ctxpopup_Direction       elm_ctxpopup_direction_get(const Evas_Object *obj);
203
204 /**
205  * @}
206  */