Mobile native

Icon

This feature is supported in mobile applications only.

An icon component is used to display standard icon images, such as "delete", "home", and "apps". The icon component inherits from the image component, and it is used to display images in an icon context.

In the following cases it is better to use an icon instead of an image:

  • You need a thumbnail version of an original image.
  • You need freedesktop.org-provided icon images.
  • You need theme-provided icon images (Edje groups).

For more information, see the Icon API.

Figure: Icon component

Icon component

Figure: Icon hierarchy

Icon hierarchy

Adding an Icon Component

To create an icon and set it as a freedesktop.org Home standard icon:

Evas_Object *icon, *parent;
icon = elm_icon_add(parent);
elm_icon_standard_set(icon, "Home");

Changing Image File

To change the image file:

  • Change the image by using an image in the filesystem (for example, /tmp/Home.png):

    elm_image_file_set(icon, "/tmp/Home.png", NULL);
    

    You can also use a group in an Edje file (for example, /tmp/Home.edj).

    elm_image_file_set(icon, "/tmp/Home.edj", "elm/icon/Home/default");
    
  • A thumbnail can be generated and cached for future use. For this, you need the Ethumb library support.

    elm_icon_thumb_set(icon, "/tmp/Home.png", NULL);
    

    This function sets the file in the icon and enables the use of a cached thumbnail if it already exists. Otherwise, it creates a new thumbnail and caches it for future use.

Using Icon Callbacks

The icon component emits the following signals:

  • thumb,done: The elm_icon_thumb_set() function is completed with success.
  • thumb,error: The elm_icon_thumb_set() function fails.

In both cases, event_info is NULL.

Note
Except as noted, this content is licensed under LGPLv2.1+.
Go to top