elementary - updated doc.
[framework/uifw/elementary.git] / src / lib / elm_hover.h
1 /**
2  * @defgroup Hover Hover
3  *
4  * @image html img/widget/hover/preview-00.png
5  * @image latex img/widget/hover/preview-00.eps
6  *
7  * A Hover object will hover over its @p parent object at the @p target
8  * location. Anything in the background will be given a darker coloring to
9  * indicate that the hover object is on top (at the default theme). When the
10  * hover is clicked it is dismissed(hidden), if the contents of the hover are
11  * clicked that @b doesn't cause the hover to be dismissed.
12  *
13  * A Hover object has two parents. One parent that owns it during creation
14  * and the other parent being the one over which the hover object spans.
15  *
16  *
17  * @note The hover object will take up the entire space of @p target
18  * object.
19  *
20  * Elementary has the following styles for the hover widget:
21  * @li default
22  * @li popout
23  * @li menu
24  * @li hoversel_vertical
25  *
26  * The following are the available position for content:
27  * @li left
28  * @li top-left
29  * @li top
30  * @li top-right
31  * @li right
32  * @li bottom-right
33  * @li bottom
34  * @li bottom-left
35  * @li middle
36  * @li smart
37  *
38  * Signals that you can add callbacks for are:
39  * @li "clicked" - the user clicked the empty space in the hover to dismiss
40  * @li "smart,changed" - a content object placed under the "smart"
41  *                   policy was replaced to a new slot direction.
42  *
43  * Supported elm_object common APIs.
44  * @li elm_object_signal_emit
45  * @li elm_object_signal_callback_add
46  * @li elm_object_signal_callback_del
47  *
48  * See @ref tutorial_hover for more information.
49  *
50  * @{
51  */
52 typedef enum
53 {
54    ELM_HOVER_AXIS_NONE, /**< ELM_HOVER_AXIS_NONE -- no prefered orientation */
55    ELM_HOVER_AXIS_HORIZONTAL, /**< ELM_HOVER_AXIS_HORIZONTAL -- horizontal */
56    ELM_HOVER_AXIS_VERTICAL, /**< ELM_HOVER_AXIS_VERTICAL -- vertical */
57    ELM_HOVER_AXIS_BOTH /**< ELM_HOVER_AXIS_BOTH -- both */
58 } Elm_Hover_Axis;
59
60 /**
61  * @brief Adds a hover object to @p parent
62  *
63  * @param parent The parent object
64  * @return The hover object or NULL if one could not be created
65  */
66 EAPI Evas_Object *elm_hover_add(Evas_Object *parent);
67
68 /**
69  * @brief Sets the target object for the hover.
70  *
71  * @param obj The hover object
72  * @param target The object to center the hover onto.
73  *
74  * This function will cause the hover to be centered on the target object.
75  */
76 EAPI void         elm_hover_target_set(Evas_Object *obj, Evas_Object *target);
77
78 /**
79  * @brief Gets the target object for the hover.
80  *
81  * @param obj The hover object
82  * @return The target object for the hover.
83  *
84  * @see elm_hover_target_set()
85  */
86 EAPI Evas_Object *elm_hover_target_get(const Evas_Object *obj);
87
88 /**
89  * @brief Sets the parent object for the hover.
90  *
91  * @param obj The hover object
92  * @param parent The object to locate the hover over.
93  *
94  * This function will cause the hover to take up the entire space that the
95  * parent object fills.
96  */
97 EAPI void         elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
98
99 /**
100  * @brief Gets the parent object for the hover.
101  *
102  * @param obj The hover object
103  * @return The parent object to locate the hover over.
104  *
105  * @see elm_hover_parent_set()
106  */
107 EAPI Evas_Object *elm_hover_parent_get(const Evas_Object *obj);
108
109 /**
110  * @brief Sets the content of the hover object and the direction in which it
111  * will pop out.
112  *
113  * @param obj The hover object
114  * @param swallow The direction that the object will be displayed
115  * at. Accepted values are "left", "top-left", "top", "top-right",
116  * "right", "bottom-right", "bottom", "bottom-left", "middle" and
117  * "smart".
118  * @param content The content to place at @p swallow
119  *
120  * Once the content object is set for a given direction, a previously
121  * set one (on the same direction) will be deleted. If you want to
122  * keep that old content object, use the elm_hover_content_unset()
123  * function.
124  *
125  * All directions may have contents at the same time, except for
126  * "smart". This is a special placement hint and its use case
127  * independs of the calculations coming from
128  * elm_hover_best_content_location_get(). Its use is for cases when
129  * one desires only one hover content, but with a dynamic special
130  * placement within the hover area. The content's geometry, whenever
131  * it changes, will be used to decide on a best location, not
132  * extrapolating the hover's parent object view to show it in (still
133  * being the hover's target determinant of its medium part -- move and
134  * resize it to simulate finger sizes, for example). If one of the
135  * directions other than "smart" are used, a previously content set
136  * using it will be deleted, and vice-versa.
137  */
138 EAPI void         elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content);
139
140 /**
141  * @brief Get the content of the hover object, in a given direction.
142  *
143  * Return the content object which was set for this widget in the
144  * @p swallow direction.
145  *
146  * @param obj The hover object
147  * @param swallow The direction that the object was display at.
148  * @return The content that was being used
149  *
150  * @see elm_hover_content_set()
151  */
152 EAPI Evas_Object *elm_hover_content_get(const Evas_Object *obj, const char *swallow);
153
154 /**
155  * @brief Unset the content of the hover object, in a given direction.
156  *
157  * Unparent and return the content object set at @p swallow direction.
158  *
159  * @param obj The hover object
160  * @param swallow The direction that the object was display at.
161  * @return The content that was being used.
162  *
163  * @see elm_hover_content_set()
164  */
165 EAPI Evas_Object *elm_hover_content_unset(Evas_Object *obj, const char *swallow);
166
167 /**
168  * @brief Returns the best swallow location for content in the hover.
169  *
170  * @param obj The hover object
171  * @param pref_axis The preferred orientation axis for the hover object to use
172  * @return The edje location to place content into the hover or @c
173  *         NULL, on errors.
174  *
175  * Best is defined here as the location at which there is the most available
176  * space.
177  *
178  * @p pref_axis may be one of
179  * - @c ELM_HOVER_AXIS_NONE -- no prefered orientation
180  * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal
181  * - @c ELM_HOVER_AXIS_VERTICAL -- vertical
182  * - @c ELM_HOVER_AXIS_BOTH -- both
183  *
184  * If ELM_HOVER_AXIS_HORIZONTAL is choosen the returned position will
185  * nescessarily be along the horizontal axis("left" or "right"). If
186  * ELM_HOVER_AXIS_VERTICAL is choosen the returned position will nescessarily
187  * be along the vertical axis("top" or "bottom"). Chossing
188  * ELM_HOVER_AXIS_BOTH or ELM_HOVER_AXIS_NONE has the same effect and the
189  * returned position may be in either axis.
190  *
191  * @see elm_hover_content_set()
192  */
193 EAPI const char  *elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis);
194
195 /**
196  * @brief Dismiss a hover object
197  *
198  * @param obj The hover object
199  * Use this function to simulate clicking outside the hover to dismiss it.
200  * In this way, the hover will be hidden and the "clicked" signal will be emitted.
201  */
202 EAPI void elm_hover_dismiss(Evas_Object *obj);
203 /**
204  * @}
205  */