2 * @defgroup Anchorblock Anchorblock
4 * @image html img/widget/anchorblock/preview-00.png
5 * @image latex img/widget/anchorblock/preview-00.eps
7 * Anchorblock 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 anchorblock 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 emits the following signals:
16 * @li "anchor,clicked": will be called when an anchor is clicked. The
17 * @p event_info parameter on the callback will be a pointer of type
18 * ::Elm_Entry_Anchorblock_Info.
24 * Since examples are usually better than plain words, we might as well
25 * try @ref tutorial_anchorblock_example "one".
29 * @addtogroup Anchorblock
34 * @typedef Elm_Entry_Anchorblock_Info
36 * The info sent in the callback for "anchor,clicked" signals emitted by
37 * the Anchorblock widget.
39 typedef struct _Elm_Entry_Anchorblock_Info Elm_Entry_Anchorblock_Info;
42 * @struct _Elm_Entry_Anchorblock_Info
44 * The info sent in the callback for "anchor,clicked" signals emitted by
45 * the Anchorblock widget.
47 struct _Elm_Entry_Anchorblock_Info
49 const char *name; /**< Name of the anchor, as indicated in its href
51 int button; /**< The mouse button used to click on it */
52 Evas_Object *hover; /**< The hover object to use for the popup */
55 Evas_Coord x, y, w, h;
56 } anchor, /**< Geometry selection of text used as anchor */
57 hover_parent; /**< Geometry of the object used as parent by the
59 Eina_Bool hover_left : 1; /**< Hint indicating if there's space
60 for content on the left side of
61 the hover. Before calling the
62 callback, the widget will make the
63 necessary calculations to check
64 which sides are fit to be set with
65 content, based on the position the
66 hover is activated and its distance
67 to the edges of its parent object
69 Eina_Bool hover_right : 1; /**< Hint indicating content fits on
70 the right side of the hover.
71 See @ref hover_left */
72 Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
73 of the hover. See @ref hover_left */
74 Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
75 below the hover. See @ref
80 * Add a new Anchorblock object
82 * @param parent The parent object
83 * @return The new object or NULL if it cannot be created
86 elm_anchorblock_add(Evas_Object *parent)
90 * Set the text to show in the anchorblock
92 * Sets the text of the anchorblock to @p text. This text can include markup
93 * format tags, including <c>\<a href=anchorname\></a></c> to begin a segment
94 * of text that will be specially styled and react to click events, ended
95 * with 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_anchorblock_text_set(Evas_Object *obj, const char *text) EINA_ARG_NONNULL(1);
108 * Get the markup text set for the anchorblock
110 * Retrieves the text set on the anchorblock, with markup tags included.
112 * @param obj The anchorblock 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_anchorblock_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 anchorblock
123 * when an anchor is clicked. See @ref Hover for more details on this.
125 * @param obj The anchorblock object
126 * @param parent The object to use as parent for the hover
128 EAPI void elm_anchorblock_hover_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1);
131 * Get the parent of the hover popup
133 * Get the object used as parent for the hover created by the anchorblock
134 * widget. See @ref Hover for more details on this.
135 * If no parent is set, the same anchorblock object will be used.
137 * @param obj The anchorblock object
138 * @return The object used as parent for the hover, NULL if none is set.
140 EAPI Evas_Object *elm_anchorblock_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, anchorblock will request that it's
146 * themed according to @p style.
148 * @param obj The anchorblock object
149 * @param style The style to use for the underlying hover
151 * @see elm_object_style_set()
153 EAPI void elm_anchorblock_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 anchorblock will use.
160 * @param obj The anchorblock 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_anchorblock_hover_style_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
168 * Ends the hover popup in the anchorblock
170 * When an anchor is clicked, the anchorblock widget will create a hover
171 * object to use as a popup with user provided content. This function
172 * terminates this popup, returning the anchorblock to its normal state.
174 * @param obj The anchorblock object
176 EAPI void elm_anchorblock_hover_end(Evas_Object *obj) EINA_ARG_NONNULL(1);
179 * Appends a custom item provider to the given anchorblock
181 * Appends the given function to the list of items providers. This list is
182 * called, one function at a time, with the given @p data pointer, the
183 * anchorblock object and, in the @p item parameter, the item name as
184 * referenced in its href string. Following functions in the list will be
185 * called in order until one of them returns something different to NULL,
186 * which should be an Evas_Object which will be used in place of the item
189 * Items in the markup text take the form \<item relsize=16x16 vsize=full
190 * href=item/name\>\</item\>
192 * @param obj The anchorblock object
193 * @param func The function to add to the list of providers
194 * @param data User data that will be passed to the callback function
196 * @see elm_entry_item_provider_append()
198 EAPI void elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data) EINA_ARG_NONNULL(1, 2);
201 * Prepend a custom item provider to the given anchorblock
203 * Like elm_anchorblock_item_provider_append(), but it adds the function
204 * @p func to the beginning of the list, instead of the end.
206 * @param obj The anchorblock object
207 * @param func The function to add to the list of providers
208 * @param data User data that will be passed to the callback function
210 EAPI void elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data) EINA_ARG_NONNULL(1, 2);
213 * Remove a custom item provider from the list of the given anchorblock
215 * Removes the function and data pairing that matches @p func and @p data.
216 * That is, unless the same function and same user data are given, the
217 * function will not be removed from the list. This allows us to add the
218 * same callback several times, with different @p data pointers and be
219 * able to remove them later without conflicts.
221 * @param obj The anchorblock object
222 * @param func The function to remove from the list
223 * @param data The data matching the function to remove from the list
225 EAPI void elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data) EINA_ARG_NONNULL(1, 2);