5 * @image html img/widget/icon/preview-00.png
6 * @image latex img/widget/icon/preview-00.eps
8 * An icon object is used to display standard icon images ("delete",
9 * "edit", "arrows", etc.) or images coming from a custom file (PNG,
10 * JPG, EDJE, etc.), on icon contexts.
12 * The icon image requested can be in the Elementary theme in use, or
13 * in the @c freedesktop.org theme paths. It's possible to set the
14 * order of preference from where an image will be fetched.
16 * This widget inherits from the @ref Image one, so that all the
17 * functions acting on it also work for icon objects.
19 * You should be using an icon, instead of an image, whenever one of
20 * the following apply:
21 * - you need a @b thumbnail version of an original image
22 * - you need freedesktop.org provided icon images
23 * - you need theme provided icon images (Edje groups)
25 * Various calls on the icon's API are marked as @b deprecated, as
26 * they just wrap the image counterpart functions. Use the ones we
27 * point you to, for each case of deprecation here, instead --
28 * eventually the deprecated ones will be discarded (next major
31 * Default images provided by Elementary's default theme are described
34 * These are names for icons that were first intended to be used in
35 * toolbars, but can be used in many other places too:
42 * @li @c "arrow_right"
51 * These are names for icons that were designed to be used in menus
52 * (but again, you can use them anywhere else):
56 * @li @c "menu/arrow_up"
57 * @li @c "menu/arrow_down"
58 * @li @c "menu/arrow_left"
59 * @li @c "menu/arrow_right"
62 * @li @c "menu/delete"
64 * @li @c "menu/refresh"
65 * @li @c "menu/folder"
68 * And these are names for some media player specific icons:
69 * @li @c "media_player/forward"
70 * @li @c "media_player/info"
71 * @li @c "media_player/next"
72 * @li @c "media_player/pause"
73 * @li @c "media_player/play"
74 * @li @c "media_player/prev"
75 * @li @c "media_player/rewind"
76 * @li @c "media_player/stop"
78 * This widget emits the following signals, besides the ones sent from
80 * - @c "thumb,done" - elm_icon_thumb_set() has completed with success
82 * - @c "thumb,error" - elm_icon_thumb_set() has failed (@since 1.1)
84 * Elementary icon objects support the following API calls:
85 * @li elm_object_signal_emit()
86 * @li elm_object_signal_callback_add()
87 * @li elm_object_signal_callback_del()
88 * for emmiting and listening to signals on the object, when the
89 * internal image comes from an Edje object. This behavior was added
90 * unintentionally, though, and is @b deprecated. Expect it to be
91 * dropped on future releases.
93 * An example of usage for this API follows:
94 * @li @ref tutorial_icon
110 * @enum Elm_Icon_Lookup_Order
111 * @typedef Elm_Icon_Lookup_Order
113 * Lookup order used by elm_icon_standard_set(). Should look for icons in the
114 * theme, FDO paths, or both?
120 ELM_ICON_LOOKUP_FDO_THEME, /**< icon look up order: freedesktop, theme */
121 ELM_ICON_LOOKUP_THEME_FDO, /**< icon look up order: theme, freedesktop */
122 ELM_ICON_LOOKUP_FDO, /**< icon look up order: freedesktop */
123 ELM_ICON_LOOKUP_THEME /**< icon look up order: theme */
124 } Elm_Icon_Lookup_Order;
127 * Add a new icon object to the parent.
129 * @param parent The parent object
130 * @return The new object or NULL if it cannot be created
132 * @see elm_icon_file_set()
136 EAPI Evas_Object *elm_icon_add(Evas_Object *parent);
139 * Set the file that will be used as icon.
141 * @param obj The icon object
142 * @param file The path to file that will be used as icon image
143 * @param group The group that the icon belongs to an edje file
145 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
147 * @note The icon image set by this function can be changed by
148 * elm_icon_standard_set().
150 * @see elm_icon_file_get()
152 * @deprecated Use elm_image_file_set() instead.
156 EAPI Eina_Bool elm_icon_file_set(Evas_Object *obj, const char *file, const char *group);
159 * Set a location in memory to be used as an icon
161 * @param obj The icon object
162 * @param img The binary data that will be used as an image
163 * @param size The size of binary data @p img
164 * @param format Optional format of @p img to pass to the image loader
165 * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
167 * The @p format string should be something like "png", "jpg", "tga",
168 * "tiff", "bmp" etc. if it is provided (NULL if not). This improves
169 * the loader performance as it tries the "correct" loader first before
170 * trying a range of other possible loaders until one succeeds.
172 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
174 * @note The icon image set by this function can be changed by
175 * elm_icon_standard_set().
177 * @deprecated Use elm_image_memfile_set() instead.
181 EAPI Eina_Bool elm_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key);
184 * Get the file that will be used as icon.
186 * @param obj The icon object
187 * @param file The path to file that will be used as the icon image
188 * @param group The group that the icon belongs to, in edje file
190 * @see elm_icon_file_set()
192 * @deprecated Use elm_image_file_get() instead.
196 EAPI void elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group);
199 * Set the file that will be used, but use a generated thumbnail.
201 * @param obj The icon object
202 * @param file The path to file that will be used as icon image
203 * @param group The group that the icon belongs to an edje file
205 * This functions like elm_icon_file_set() but requires the Ethumb library
206 * support to be enabled successfully with elm_need_ethumb(). When set
207 * the file indicated has a thumbnail generated and cached on disk for
208 * future use or will directly use an existing cached thumbnail if it
211 * @see elm_icon_file_set()
215 EAPI void elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group);
218 * Set the icon by icon standards names.
220 * @param obj The icon object
221 * @param name The icon name
223 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
225 * For example, freedesktop.org defines standard icon names such as "home",
226 * "network", etc. There can be different icon sets to match those icon
227 * keys. The @p name given as parameter is one of these "keys", and will be
228 * used to look in the freedesktop.org paths and elementary theme. One can
229 * change the lookup order with elm_icon_order_lookup_set().
231 * If name is not found in any of the expected locations and it is the
232 * absolute path of an image file, this image will be used.
234 * @note The icon image set by this function can be changed by
235 * elm_icon_file_set().
237 * @see elm_icon_standard_get()
238 * @see elm_icon_file_set()
242 EAPI Eina_Bool elm_icon_standard_set(Evas_Object *obj, const char *name);
245 * Get the icon name set by icon standard names.
247 * @param obj The icon object
248 * @return The icon name
250 * If the icon image was set using elm_icon_file_set() instead of
251 * elm_icon_standard_set(), then this function will return @c NULL.
253 * @see elm_icon_standard_set()
257 EAPI const char *elm_icon_standard_get(const Evas_Object *obj);
260 * Set the smooth scaling for an icon object.
262 * @param obj The icon object
263 * @param smooth @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE
264 * otherwise. Default is @c EINA_TRUE.
266 * Set the scaling algorithm to be used when scaling the icon image. Smooth
267 * scaling provides a better resulting image, but is slower.
269 * The smooth scaling should be disabled when making animations that change
270 * the icon size, since they will be faster. Animations that don't require
271 * resizing of the icon can keep the smooth scaling enabled (even if the icon
272 * is already scaled, since the scaled icon image will be cached).
274 * @see elm_icon_smooth_get()
276 * @deprecated Use elm_image_smooth_set() instead.
280 EAPI void elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth);
283 * Get whether smooth scaling is enabled for an icon object.
285 * @param obj The icon object
286 * @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise.
288 * @see elm_icon_smooth_set()
290 * @deprecated Use elm_image_smooth_get() instead.
294 EAPI Eina_Bool elm_icon_smooth_get(const Evas_Object *obj);
297 * Disable scaling of this object.
299 * @param obj The icon object.
300 * @param no_scale @c EINA_TRUE if the object is not scalable, @c EINA_FALSE
301 * otherwise. Default is @c EINA_FALSE.
303 * This function disables scaling of the icon object through the function
304 * elm_object_scale_set(). However, this does not affect the object
305 * size/resize in any way. For that effect, take a look at
306 * elm_icon_resizable_set().
308 * @see elm_icon_no_scale_get()
309 * @see elm_icon_resizable_set()
310 * @see elm_object_scale_set()
312 * @deprecated Use elm_image_no_scale_set() instead.
316 EAPI void elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale);
319 * Get whether scaling is disabled on the object.
321 * @param obj The icon object
322 * @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise
324 * @see elm_icon_no_scale_set()
326 * @deprecated Use elm_image_no_scale_get() instead.
330 EAPI Eina_Bool elm_icon_no_scale_get(const Evas_Object *obj);
333 * Set if the object is (up/down) resizable.
335 * @param obj The icon object
336 * @param size_up A bool to set if the object is resizable up. Default is
338 * @param size_down A bool to set if the object is resizable down. Default
341 * This function limits the icon object resize ability. If @p size_up is set to
342 * @c EINA_FALSE, the object can't have its height or width resized to a value
343 * higher than the original icon size. Same is valid for @p size_down.
345 * @see elm_icon_resizable_get()
347 * @deprecated Use elm_image_resizable_set() instead.
351 EAPI void elm_icon_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down);
354 * Get if the object is (up/down) resizable.
356 * @param obj The icon object
357 * @param size_up A bool to set if the object is resizable up
358 * @param size_down A bool to set if the object is resizable down
360 * @see elm_icon_resizable_set()
362 * @deprecated Use elm_image_resizable_get() instead.
366 EAPI void elm_icon_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down);
369 * Get the object's image size
371 * @param obj The icon object
372 * @param w A pointer to store the width in
373 * @param h A pointer to store the height in
375 * @deprecated Use elm_image_object_size_get() instead.
379 EAPI void elm_icon_size_get(const Evas_Object *obj, int *w, int *h);
382 * Set if the icon fill the entire object area.
384 * @param obj The icon object
385 * @param fill_outside @c EINA_TRUE if the object is filled outside,
386 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
388 * When the icon object is resized to a different aspect ratio from the
389 * original icon image, the icon image will still keep its aspect. This flag
390 * tells how the image should fill the object's area. They are: keep the
391 * entire icon inside the limits of height and width of the object (@p
392 * fill_outside is @c EINA_FALSE) or let the extra width or height go outside
393 * of the object, and the icon will fill the entire object (@p fill_outside
396 * @note Unlike @ref Image, there's no option in icon to set the aspect ratio
397 * retain property to false. Thus, the icon image will always keep its
398 * original aspect ratio.
400 * @see elm_icon_fill_outside_get()
401 * @see elm_image_fill_outside_set()
405 EAPI void elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside);
408 * Get if the object is filled outside.
410 * @param obj The icon object
411 * @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE
414 * @see elm_icon_fill_outside_set()
416 * @deprecated Use elm_image_fill_outside_get() instead.
420 EAPI Eina_Bool elm_icon_fill_outside_get(const Evas_Object *obj);
423 * Set the prescale size for the icon.
425 * @param obj The icon object
426 * @param size The prescale size. This value is used for both width and
429 * This function sets a new size for pixmap representation of the given
430 * icon. It allows the icon to be loaded already in the specified size,
431 * reducing the memory usage and load time when loading a big icon with load
432 * size set to a smaller size.
434 * It's equivalent to the elm_bg_load_size_set() function for bg.
436 * @note this is just a hint, the real size of the pixmap may differ
437 * depending on the type of icon being loaded, being bigger than requested.
439 * @see elm_icon_prescale_get()
440 * @see elm_bg_load_size_set()
442 * @deprecated Use elm_image_prescale_set() instead.
446 EAPI void elm_icon_prescale_set(Evas_Object *obj, int size);
449 * Get the prescale size for the icon.
451 * @param obj The icon object
452 * @return The prescale size
454 * @see elm_icon_prescale_set()
456 * @deprecated Use elm_image_prescale_get() instead.
460 EAPI int elm_icon_prescale_get(const Evas_Object *obj);
463 * Gets the image object of the icon. DO NOT MODIFY THIS.
465 * @param obj The icon object
466 * @return The internal icon object
468 * @deprecated Use elm_image_object_get() instead.
472 EAPI Evas_Object *elm_icon_object_get(Evas_Object *obj);
475 * Sets the icon lookup order used by elm_icon_standard_set().
477 * @param obj The icon object
478 * @param order The icon lookup order (can be one of
479 * ELM_ICON_LOOKUP_FDO_THEME, ELM_ICON_LOOKUP_THEME_FDO, ELM_ICON_LOOKUP_FDO
480 * or ELM_ICON_LOOKUP_THEME)
482 * @see elm_icon_order_lookup_get()
483 * @see Elm_Icon_Lookup_Order
487 EAPI void elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order);
490 * Gets the icon lookup order.
492 * @param obj The icon object
493 * @return The icon lookup order
495 * @see elm_icon_order_lookup_set()
496 * @see Elm_Icon_Lookup_Order
500 EAPI Elm_Icon_Lookup_Order elm_icon_order_lookup_get(const Evas_Object *obj);
503 * Enable or disable preloading of the icon
505 * @param obj The icon object
506 * @param disabled If EINA_TRUE, preloading will be disabled
509 * @deprecated Use elm_image_preload_disabled_set() instead.
512 EAPI void elm_icon_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled);
515 * Get if the icon supports animation or not.
517 * @param obj The icon object
518 * @return @c EINA_TRUE if the icon supports animation,
519 * @c EINA_FALSE otherwise.
521 * Return if this elm icon's image can be animated. Currently Evas only
522 * supports gif animation. If the return value is EINA_FALSE, other
523 * elm_icon_animated_xxx APIs won't work.
526 * @deprecated Use elm_image_animated_available_get() instead.
529 EAPI Eina_Bool elm_icon_animated_available_get(const Evas_Object *obj);
532 * Set animation mode of the icon.
534 * @param obj The icon object
535 * @param animated @c EINA_TRUE if the object do animation job,
536 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
538 * Since the default animation mode is set to EINA_FALSE,
539 * the icon is shown without animation. Files like animated GIF files
540 * can animate, and this is supported if you enable animated support
542 * Set it to EINA_TRUE when the icon needs to be animated.
545 * @deprecated Use elm_image_animated_set() instead.
548 EAPI void elm_icon_animated_set(Evas_Object *obj, Eina_Bool animated);
551 * Get animation mode of the icon.
553 * @param obj The icon object
554 * @return The animation mode of the icon object
555 * @see elm_icon_animated_set
558 * @deprecated Use elm_image_animated_get() instead.
561 EAPI Eina_Bool elm_icon_animated_get(const Evas_Object *obj);
564 * Set animation play mode of the icon.
566 * @param obj The icon object
567 * @param play @c EINA_TRUE the object play animation images,
568 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
570 * To play elm icon's animation, set play to EINA_TRUE.
571 * For example, you make gif player using this set/get API and click event.
572 * This literally lets you control current play or paused state. To have
573 * this work with animated GIF files for example, you first, before
574 * setting the file have to use elm_icon_animated_set() to enable animation
575 * at all on the icon.
577 * 1. Click event occurs
578 * 2. Check play flag using elm_icon_animated_play_get
579 * 3. If elm icon was playing, set play to EINA_FALSE.
580 * Then animation will be stopped and vice versa
583 * @deprecated Use elm_image_animated_play_set() instead.
586 EAPI void elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play);
589 * Get animation play mode of the icon.
591 * @param obj The icon object
592 * @return The play mode of the icon object
594 * @see elm_icon_animated_play_get
597 * @deprecated Use elm_image_animated_play_get() instead.
600 EAPI Eina_Bool elm_icon_animated_play_get(const Evas_Object *obj);
603 * Set whether the original aspect ratio of the icon should be kept on resize.
605 * @param obj The icon object.
606 * @param fixed @c EINA_TRUE if the icon should retain the aspect,
607 * @c EINA_FALSE otherwise.
609 * The original aspect ratio (width / height) of the icon is usually
610 * distorted to match the object's size. Enabling this option will retain
611 * this original aspect, and the way that the icon is fit into the object's
612 * area depends on the option set by elm_icon_fill_outside_set().
614 * @see elm_icon_aspect_fixed_get()
615 * @see elm_icon_fill_outside_set()
619 * @deprecated Use elm_image_aspect_fixed_set() instead.
622 EAPI void elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
625 * Get if the object retains the original aspect ratio.
627 * @param obj The icon object.
628 * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE
631 * @deprecated Use elm_image_aspect_fixed_get() instead.
635 EAPI Eina_Bool elm_icon_aspect_fixed_get(const Evas_Object *obj);