4 * @image html img/widget/icon/preview-00.png
5 * @image latex img/widget/icon/preview-00.eps
7 * An object that provides standard icon images (delete, edit, arrows, etc.)
8 * or a custom file (PNG, JPG, EDJE, etc.) used for an icon.
10 * The icon image requested can be in the elementary theme, or in the
11 * freedesktop.org paths. It's possible to set the order of preference from
12 * where the image will be used.
14 * This API is very similar to @ref Image, but with ready to use images.
16 * Default images provided by the theme are described below.
18 * The first list contains icons that were first intended to be used in
19 * toolbars, but can be used in many other places too:
35 * Now some icons that were designed to be used in menus (but again, you can
36 * use them anywhere else):
43 * @li menu/arrow_right
52 * And here we have some media player specific icons:
53 * @li media_player/forward
54 * @li media_player/info
55 * @li media_player/next
56 * @li media_player/pause
57 * @li media_player/play
58 * @li media_player/prev
59 * @li media_player/rewind
60 * @li media_player/stop
62 * Signals that you can add callbacks for are:
64 * "clicked" - This is called when a user has clicked the icon
66 * Supported elm_object common APIs.
67 * @li elm_object_signal_emit
68 * @li elm_object_signal_callback_add
69 * @li elm_object_signal_callback_del
71 * An example of usage for this API follows:
72 * @li @ref tutorial_icon
88 * @enum _Elm_Icon_Lookup_Order
89 * @typedef Elm_Icon_Lookup_Order
91 * Lookup order used by elm_icon_standard_set(). Should look for icons in the
92 * theme, FDO paths, or both?
98 ELM_ICON_LOOKUP_FDO_THEME, /**< icon look up order: freedesktop, theme */
99 ELM_ICON_LOOKUP_THEME_FDO, /**< icon look up order: theme, freedesktop */
100 ELM_ICON_LOOKUP_FDO, /**< icon look up order: freedesktop */
101 ELM_ICON_LOOKUP_THEME /**< icon look up order: theme */
102 } Elm_Icon_Lookup_Order;
105 * Add a new icon object to the parent.
107 * @param parent The parent object
108 * @return The new object or NULL if it cannot be created
110 * @see elm_icon_file_set()
114 EAPI Evas_Object *elm_icon_add(Evas_Object *parent);
117 * Set the file that will be used as icon.
119 * @param obj The icon object
120 * @param file The path to file that will be used as icon image
121 * @param group The group that the icon belongs to an edje file
123 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
125 * @note The icon image set by this function can be changed by
126 * elm_icon_standard_set().
128 * @see elm_icon_file_get()
132 EAPI Eina_Bool elm_icon_file_set(Evas_Object *obj, const char *file, const char *group);
135 * Set a location in memory to be used as an icon
137 * @param obj The icon object
138 * @param img The binary data that will be used as an image
139 * @param size The size of binary data @p img
140 * @param format Optional format of @p img to pass to the image loader
141 * @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
143 * The @p format string should be something like "png", "jpg", "tga",
144 * "tiff", "bmp" etc. if it is provided (NULL if not). This improves
145 * the loader performance as it tries the "correct" loader first before
146 * trying a range of other possible loaders until one succeeds.
148 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
150 * @note The icon image set by this function can be changed by
151 * elm_icon_standard_set().
155 EAPI Eina_Bool elm_icon_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key);
158 * Get the file that will be used as icon.
160 * @param obj The icon object
161 * @param file The path to file that will be used as the icon image
162 * @param group The group that the icon belongs to, in edje file
164 * @see elm_icon_file_set()
168 EAPI void elm_icon_file_get(const Evas_Object *obj, const char **file, const char **group);
171 * Set the file that will be used, but use a generated thumbnail.
173 * @param obj The icon object
174 * @param file The path to file that will be used as icon image
175 * @param group The group that the icon belongs to an edje file
177 * This functions like elm_icon_file_set() but requires the Ethumb library
178 * support to be enabled successfully with elm_need_ethumb(). When set
179 * the file indicated has a thumbnail generated and cached on disk for
180 * future use or will directly use an existing cached thumbnail if it
183 * @see elm_icon_file_set()
187 EAPI void elm_icon_thumb_set(Evas_Object *obj, const char *file, const char *group);
190 * Set the icon by icon standards names.
192 * @param obj The icon object
193 * @param name The icon name
195 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
197 * For example, freedesktop.org defines standard icon names such as "home",
198 * "network", etc. There can be different icon sets to match those icon
199 * keys. The @p name given as parameter is one of these "keys", and will be
200 * used to look in the freedesktop.org paths and elementary theme. One can
201 * change the lookup order with elm_icon_order_lookup_set().
203 * If name is not found in any of the expected locations and it is the
204 * absolute path of an image file, this image will be used.
206 * @note The icon image set by this function can be changed by
207 * elm_icon_file_set().
209 * @see elm_icon_standard_get()
210 * @see elm_icon_file_set()
214 EAPI Eina_Bool elm_icon_standard_set(Evas_Object *obj, const char *name);
217 * Get the icon name set by icon standard names.
219 * @param obj The icon object
220 * @return The icon name
222 * If the icon image was set using elm_icon_file_set() instead of
223 * elm_icon_standard_set(), then this function will return @c NULL.
225 * @see elm_icon_standard_set()
229 EAPI const char *elm_icon_standard_get(const Evas_Object *obj);
232 * Set the smooth scaling for an icon object.
234 * @param obj The icon object
235 * @param smooth @c EINA_TRUE if smooth scaling should be used, @c EINA_FALSE
236 * otherwise. Default is @c EINA_TRUE.
238 * Set the scaling algorithm to be used when scaling the icon image. Smooth
239 * scaling provides a better resulting image, but is slower.
241 * The smooth scaling should be disabled when making animations that change
242 * the icon size, since they will be faster. Animations that don't require
243 * resizing of the icon can keep the smooth scaling enabled (even if the icon
244 * is already scaled, since the scaled icon image will be cached).
246 * @see elm_icon_smooth_get()
250 EAPI void elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth);
253 * Get whether smooth scaling is enabled for an icon object.
255 * @param obj The icon object
256 * @return @c EINA_TRUE if smooth scaling is enabled, @c EINA_FALSE otherwise.
258 * @see elm_icon_smooth_set()
262 EAPI Eina_Bool elm_icon_smooth_get(const Evas_Object *obj);
265 * Disable scaling of this object.
267 * @param obj The icon object.
268 * @param no_scale @c EINA_TRUE if the object is not scalable, @c EINA_FALSE
269 * otherwise. Default is @c EINA_FALSE.
271 * This function disables scaling of the icon object through the function
272 * elm_object_scale_set(). However, this does not affect the object
273 * size/resize in any way. For that effect, take a look at
274 * elm_icon_resizable_set().
276 * @see elm_icon_no_scale_get()
277 * @see elm_icon_resizable_set()
278 * @see elm_object_scale_set()
282 EAPI void elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale);
285 * Get whether scaling is disabled on the object.
287 * @param obj The icon object
288 * @return @c EINA_TRUE if scaling is disabled, @c EINA_FALSE otherwise
290 * @see elm_icon_no_scale_set()
294 EAPI Eina_Bool elm_icon_no_scale_get(const Evas_Object *obj);
297 * Set if the object is (up/down) resizable.
299 * @param obj The icon object
300 * @param size_up A bool to set if the object is resizable up. Default is
302 * @param size_down A bool to set if the object is resizable down. Default
305 * This function limits the icon object resize ability. If @p size_up is set to
306 * @c EINA_FALSE, the object can't have its height or width resized to a value
307 * higher than the original icon size. Same is valid for @p size_down.
309 * @see elm_icon_resizable_get()
313 EAPI void elm_icon_resizable_set(Evas_Object *obj, Eina_Bool size_up, Eina_Bool size_down);
316 * Get if the object is (up/down) resizable.
318 * @param obj The icon object
319 * @param size_up A bool to set if the object is resizable up
320 * @param size_down A bool to set if the object is resizable down
322 * @see elm_icon_resizable_set()
326 EAPI void elm_icon_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down);
329 * Get the object's image size
331 * @param obj The icon object
332 * @param w A pointer to store the width in
333 * @param h A pointer to store the height in
337 EAPI void elm_icon_size_get(const Evas_Object *obj, int *w, int *h);
340 * Set if the icon fill the entire object area.
342 * @param obj The icon object
343 * @param fill_outside @c EINA_TRUE if the object is filled outside,
344 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
346 * When the icon object is resized to a different aspect ratio from the
347 * original icon image, the icon image will still keep its aspect. This flag
348 * tells how the image should fill the object's area. They are: keep the
349 * entire icon inside the limits of height and width of the object (@p
350 * fill_outside is @c EINA_FALSE) or let the extra width or height go outside
351 * of the object, and the icon will fill the entire object (@p fill_outside
354 * @note Unlike @ref Image, there's no option in icon to set the aspect ratio
355 * retain property to false. Thus, the icon image will always keep its
356 * original aspect ratio.
358 * @see elm_icon_fill_outside_get()
359 * @see elm_image_fill_outside_set()
363 EAPI void elm_icon_fill_outside_set(Evas_Object *obj, Eina_Bool fill_outside);
366 * Get if the object is filled outside.
368 * @param obj The icon object
369 * @return @c EINA_TRUE if the object is filled outside, @c EINA_FALSE otherwise.
371 * @see elm_icon_fill_outside_set()
375 EAPI Eina_Bool elm_icon_fill_outside_get(const Evas_Object *obj);
378 * Set the prescale size for the icon.
380 * @param obj The icon object
381 * @param size The prescale size. This value is used for both width and
384 * This function sets a new size for pixmap representation of the given
385 * icon. It allows the icon to be loaded already in the specified size,
386 * reducing the memory usage and load time when loading a big icon with load
387 * size set to a smaller size.
389 * It's equivalent to the elm_bg_load_size_set() function for bg.
391 * @note this is just a hint, the real size of the pixmap may differ
392 * depending on the type of icon being loaded, being bigger than requested.
394 * @see elm_icon_prescale_get()
395 * @see elm_bg_load_size_set()
399 EAPI void elm_icon_prescale_set(Evas_Object *obj, int size);
402 * Get the prescale size for the icon.
404 * @param obj The icon object
405 * @return The prescale size
407 * @see elm_icon_prescale_set()
411 EAPI int elm_icon_prescale_get(const Evas_Object *obj);
414 * Gets the image object of the icon. DO NOT MODIFY THIS.
416 * @param obj The icon object
417 * @return The internal icon object
421 EAPI Evas_Object *elm_icon_object_get(Evas_Object *obj);
424 * Sets the icon lookup order used by elm_icon_standard_set().
426 * @param obj The icon object
427 * @param order The icon lookup order (can be one of
428 * ELM_ICON_LOOKUP_FDO_THEME, ELM_ICON_LOOKUP_THEME_FDO, ELM_ICON_LOOKUP_FDO
429 * or ELM_ICON_LOOKUP_THEME)
431 * @see elm_icon_order_lookup_get()
432 * @see Elm_Icon_Lookup_Order
436 EAPI void elm_icon_order_lookup_set(Evas_Object *obj, Elm_Icon_Lookup_Order order);
439 * Gets the icon lookup order.
441 * @param obj The icon object
442 * @return The icon lookup order
444 * @see elm_icon_order_lookup_set()
445 * @see Elm_Icon_Lookup_Order
449 EAPI Elm_Icon_Lookup_Order elm_icon_order_lookup_get(const Evas_Object *obj);
452 * Enable or disable preloading of the icon
454 * @param obj The icon object
455 * @param disabled If EINA_TRUE, preloading will be disabled
458 EAPI void elm_icon_preload_disabled_set(Evas_Object *obj, Eina_Bool disabled);
461 * Get if the icon supports animation or not.
463 * @param obj The icon object
464 * @return @c EINA_TRUE if the icon supports animation,
465 * @c EINA_FALSE otherwise.
467 * Return if this elm icon's image can be animated. Currently Evas only
468 * supports gif animation. If the return value is EINA_FALSE, other
469 * elm_icon_animated_xxx APIs won't work.
472 EAPI Eina_Bool elm_icon_animated_available_get(const Evas_Object *obj);
475 * Set animation mode of the icon.
477 * @param obj The icon object
478 * @param animated @c EINA_TRUE if the object do animation job,
479 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
481 * Since the default animation mode is set to EINA_FALSE,
482 * the icon is shown without animation. Files like animated GIF files
483 * can animate, and this is supported if you enable animated support
485 * Set it to EINA_TRUE when the icon needs to be animated.
488 EAPI void elm_icon_animated_set(Evas_Object *obj, Eina_Bool animated);
491 * Get animation mode of the icon.
493 * @param obj The icon object
494 * @return The animation mode of the icon object
495 * @see elm_icon_animated_set
498 EAPI Eina_Bool elm_icon_animated_get(const Evas_Object *obj);
501 * Set animation play mode of the icon.
503 * @param obj The icon object
504 * @param play @c EINA_TRUE the object play animation images,
505 * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
507 * To play elm icon's animation, set play to EINA_TRUE.
508 * For example, you make gif player using this set/get API and click event.
509 * This literally lets you control current play or paused state. To have
510 * this work with animated GIF files for example, you first, before
511 * setting the file have to use elm_icon_animated_set() to enable animation
512 * at all on the icon.
514 * 1. Click event occurs
515 * 2. Check play flag using elm_icon_animated_play_get
516 * 3. If elm icon was playing, set play to EINA_FALSE.
517 * Then animation will be stopped and vice versa
520 EAPI void elm_icon_animated_play_set(Evas_Object *obj, Eina_Bool play);
523 * Get animation play mode of the icon.
525 * @param obj The icon object
526 * @return The play mode of the icon object
528 * @see elm_icon_animated_play_get
531 EAPI Eina_Bool elm_icon_animated_play_get(const Evas_Object *obj);
534 * Set whether the original aspect ratio of the icon should be kept on resize.
536 * @param obj The icon object.
537 * @param fixed @c EINA_TRUE if the icon should retain the aspect,
538 * @c EINA_FALSE otherwise.
540 * The original aspect ratio (width / height) of the icon is usually
541 * distorted to match the object's size. Enabling this option will retain
542 * this original aspect, and the way that the icon is fit into the object's
543 * area depends on the option set by elm_icon_fill_outside_set().
545 * @see elm_icon_aspect_fixed_get()
546 * @see elm_icon_fill_outside_set()
550 EAPI void elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
553 * Get if the object retains the original aspect ratio.
555 * @param obj The icon object.
556 * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE
561 EAPI Eina_Bool elm_icon_aspect_fixed_get(const Evas_Object *obj);