2 * @defgroup Anchorview Anchorview
4 * @image html img/widget/anchorview/preview-00.png
5 * @image latex img/widget/anchorview/preview-00.eps
7 * Anchorview is for displaying text that contains markup with anchors
8 * like <c>\<a href=1234\>something\</\></c> in it.
10 * Besides being styled differently, the anchorview widget provides the
11 * necessary functionality so that clicking on these anchors brings up a
12 * popup with user defined content such as "call", "add to contacts" or
13 * "open web page". This popup is provided using the @ref Hover widget.
15 * This widget is very similar to @ref Anchorblock, so refer to that
16 * widget for an example. The only difference Anchorview has is that the
17 * widget is already provided with scrolling functionality, so if the
18 * text set to it is too large to fit in the given space, it will scroll,
19 * whereas the @ref Anchorblock widget will keep growing to ensure all the
20 * text can be displayed.
22 * This widget emits the following signals:
23 * @li "anchor,clicked": will be called when an anchor is clicked. The
24 * @p event_info parameter on the callback will be a pointer of type
25 * ::Elm_Entry_Anchorview_Info.
27 * See @ref Anchorblock for an example on how to use both of them.
37 * @typedef Elm_Entry_Anchorview_Info
39 * The info sent in the callback for "anchor,clicked" signals emitted by
40 * the Anchorview widget.
42 typedef struct _Elm_Entry_Anchorview_Info Elm_Entry_Anchorview_Info;
45 * @struct _Elm_Entry_Anchorview_Info
47 * The info sent in the callback for "anchor,clicked" signals emitted by
48 * the Anchorview widget.
50 struct _Elm_Entry_Anchorview_Info
52 const char *name; /**< Name of the anchor, as indicated in its href
54 int button; /**< The mouse button used to click on it */
55 Evas_Object *hover; /**< The hover object to use for the popup */
57 Evas_Coord x, y, w, h;
58 } anchor, /**< Geometry selection of text used as anchor */
59 hover_parent; /**< Geometry of the object used as parent by the
61 Eina_Bool hover_left : 1; /**< Hint indicating if there's space
62 for content on the left side of
63 the hover. Before calling the
64 callback, the widget will make the
65 necessary calculations to check
66 which sides are fit to be set with
67 content, based on the position the
68 hover is activated and its distance
69 to the edges of its parent object
71 Eina_Bool hover_right : 1; /**< Hint indicating content fits on
72 the right side of the hover.
73 See @ref hover_left */
74 Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
75 of the hover. See @ref hover_left */
76 Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
77 below the hover. See @ref
82 * Add a new Anchorview object
84 * @param parent The parent object
85 * @return The new object or NULL if it cannot be created
87 EAPI Evas_Object *elm_anchorview_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
90 * Set the text to show in the anchorview
92 * Sets the text of the anchorview to @p text. This text can include markup
93 * format tags, including <c>\<a href=anchorname\></c> to begin a segment of
94 * text that will be specially styled and react to click events, ended with
95 * either of \</a\> or \</\>. When clicked, the anchor will emit an
96 * "anchor,clicked" signal that you can attach a callback to with
97 * evas_object_smart_callback_add(). The name of the anchor given in the
98 * event info struct will be the one set in the href attribute, in this
101 * Other markup can be used to style the text in different ways, but it's
102 * up to the style defined in the theme which tags do what.
103 * @deprecated use elm_object_text_set() instead.
105 EINA_DEPRECATED EAPI void elm_anchorview_text_set(Evas_Object *obj, const char *text) EINA_ARG_NONNULL(1);
108 * Get the markup text set for the anchorview
110 * Retrieves the text set on the anchorview, with markup tags included.
112 * @param obj The anchorview object
113 * @return The markup text set or @c NULL if nothing was set or an error
115 * @deprecated use elm_object_text_set() instead.
117 EINA_DEPRECATED EAPI const char *elm_anchorview_text_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
120 * Set the parent of the hover popup
122 * Sets the parent object to use by the hover created by the anchorview
123 * when an anchor is clicked. See @ref Hover for more details on this.
124 * If no parent is set, the same anchorview object will be used.
126 * @param obj The anchorview object
127 * @param parent The object to use as parent for the hover
129 EAPI void elm_anchorview_hover_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1);
132 * Get the parent of the hover popup
134 * Get the object used as parent for the hover created by the anchorview
135 * widget. See @ref Hover for more details on this.
137 * @param obj The anchorview object
138 * @return The object used as parent for the hover, NULL if none is set.
140 EAPI Evas_Object *elm_anchorview_hover_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
143 * Set the style that the hover should use
145 * When creating the popup hover, anchorview will request that it's
146 * themed according to @p style.
148 * @param obj The anchorview object
149 * @param style The style to use for the underlying hover
151 * @see elm_object_style_set()
153 EAPI void elm_anchorview_hover_style_set(Evas_Object *obj, const char *style) EINA_ARG_NONNULL(1);
156 * Get the style that the hover should use
158 * Get the style the hover created by anchorview will use.
160 * @param obj The anchorview object
161 * @return The style to use by the hover. NULL means the default is used.
163 * @see elm_object_style_set()
165 EAPI const char *elm_anchorview_hover_style_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
168 * Ends the hover popup in the anchorview
170 * When an anchor is clicked, the anchorview widget will create a hover
171 * object to use as a popup with user provided content. This function
172 * terminates this popup, returning the anchorview to its normal state.
174 * @param obj The anchorview object
176 EAPI void elm_anchorview_hover_end(Evas_Object *obj) EINA_ARG_NONNULL(1);
179 * Set bouncing behaviour when the scrolled content reaches an edge
181 * Tell the internal scroller object whether it should bounce or not
182 * when it reaches the respective edges for each axis.
184 * @param obj The anchorview object
185 * @param h_bounce Whether to bounce or not in the horizontal axis
186 * @param v_bounce Whether to bounce or not in the vertical axis
188 * @see elm_scroller_bounce_set()
190 EAPI void elm_anchorview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) EINA_ARG_NONNULL(1);
193 * Get the set bouncing behaviour of the internal scroller
195 * Get whether the internal scroller should bounce when the edge of each
196 * axis is reached scrolling.
198 * @param obj The anchorview object
199 * @param h_bounce Pointer where to store the bounce state of the horizontal
201 * @param v_bounce Pointer where to store the bounce state of the vertical
204 * @see elm_scroller_bounce_get()
206 EAPI void elm_anchorview_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) EINA_ARG_NONNULL(1);
209 * Appends a custom item provider to the given anchorview
211 * Appends the given function to the list of items providers. This list is
212 * called, one function at a time, with the given @p data pointer, the
213 * anchorview object and, in the @p item parameter, the item name as
214 * referenced in its href string. Following functions in the list will be
215 * called in order until one of them returns something different to NULL,
216 * which should be an Evas_Object which will be used in place of the item
219 * Items in the markup text take the form \<item relsize=16x16 vsize=full
220 * href=item/name\>\</item\>
222 * @param obj The anchorview object
223 * @param func The function to add to the list of providers
224 * @param data User data that will be passed to the callback function
226 * @see elm_entry_item_provider_append()
228 EAPI void elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data) EINA_ARG_NONNULL(1, 2);
231 * Prepend a custom item provider to the given anchorview
233 * Like elm_anchorview_item_provider_append(), but it adds the function
234 * @p func to the beginning of the list, instead of the end.
236 * @param obj The anchorview object
237 * @param func The function to add to the list of providers
238 * @param data User data that will be passed to the callback function
240 EAPI void elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data) EINA_ARG_NONNULL(1, 2);
243 * Remove a custom item provider from the list of the given anchorview
245 * Removes the function and data pairing that matches @p func and @p data.
246 * That is, unless the same function and same user data are given, the
247 * function will not be removed from the list. This allows us to add the
248 * same callback several times, with different @p data pointers and be
249 * able to remove them later without conflicts.
251 * @param obj The anchorview object
252 * @param func The function to remove from the list
253 * @param data The data matching the function to remove from the list
255 EAPI void elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data) EINA_ARG_NONNULL(1, 2);