Languages

Menu
Sites
Language
How to use the elm_icon_standard_set()

As below, the elm_icon_standard_set api proto.

/**
 * @brief Sets the icon by icon standard names.
 *
 * @since_tizen 2.3
 *
 * @remarks For example, freedesktop.org defines the standard icon names such as "home",
 *          "network", etc. There can be different icon sets to match those icon
 *          keys. The @a name given as a parameter is one of these "keys", and is
 *          used to look in the freedesktop.org paths and elementary theme. One can
 *          change the lookup order with elm_icon_order_lookup_set().
 *
 * @remarks If @a name is not found in any of the expected locations and it is the
 *          absolute path of an image file, this image is used.
 *
 * @remarks The icon image set by this function can be changed by
 *          elm_image_file_set().
 *
 * @param[in] obj The icon object
 * @param[in] name The icon name
 *
 * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
 *
 * @see elm_icon_standard_get()
 * @see elm_image_file_set()
 */
EAPI Eina_Bool             elm_icon_standard_set(Evas_Object *obj, const char *name);

I've found sample code from the IDE help,

Evas_Object *icon;
Elm_Map_Overlay *forest_class = elm_map_overlay_class_add(map);

// Set min zoom level at which class is displayed
elm_map_overlay_displayed_zoom_min_set(forest_class, 8);

// Create a Home icon object and set it to the forest class 
icon = elm_icon_add(map);
elm_icon_standard_set(icon, "home");
elm_map_overlay_icon_set(forest_class, icon);

Seems the icon standard name "home" should be predefined in somewhere, and the name should map to a real path of an image. Right?

Or, tizen will try to search such image by name (here it's "home") in some default folders (such as res/images, or shared/res, etc.).

Actually, I've put some images into the res/images and shared/res, and call elm_icon_standard_set(icon, "image_name"), but seems it's not working, I don't know why?

Is anybody know the root cause? Or how to configure/predefine the standard icon name(where to define it?). Many thanks!!!

Edited by: colin Rao on 20 Aug, 2015

Responses

5 Replies
Alex Dem

Hi,
I was able to add standart icons (home, close) only onto layout with edc markup this way:
 

ad->icon= elm_icon_add(ad->layout);
elm_icon_standard_set(ad->icon, "close");
elm_object_part_content_set(ad->layout, "icon_part", ad->icon);

icon_part  type: SWALLOW. 
Alexey.

Alex Dem

Also I have tried approach as for table container (from dev-guide)

    Evas_Object *ic = elm_icon_add(table);
    elm_icon_standard_set(ic, "close");
    evas_object_show(ic);
    elm_table_pack(table, ic, 1, 2, 1, 1);

but was not success.
Alexey.

Jean Yang

I also tried this, but failed to show the icon.

The programming guide for Icon Widget is as following.

The icon widget inherits from the image widget. It is used to display images in an icon context.

Adding an Icon
We can 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");

I tried to add it to window, conformant, box, label, button, all not success.

Here is an example I add it into box.

 /* Icon */
 Evas_Object* icon;
 icon = elm_icon_add(ad->box);
 elm_icon_standard_set(icon, "chat");

 

colin Rao

I don't know why?

For non-standard(not predefined) images, such as put into res/images or shared/res, those image can be set by full path, example as below

elm_icon_standard_set(icon, "/opt/usr/apps/org.tizen.xxx/shared/res/location_32.png");

or,

elm_image_file_set(icon, "/opt/usr/apps/org.tizen.xxx/shared/res/location_32.png", NULL);

pius lee

Basically, every elementary widgets have own EDJE theme.

Any elementary widget is actually function wrapper of EDJE layout.

So every part name or some symbol is written in elementary code or EDC file. (sure device or emulator have EDJ file that builded from EDC)

https://review.tizen.org/git/?p=framework/uifw/efl-theme-tizen.git;a=blob;f=2.3-mobile/widgets_default/icon.edc;h=fed701953125b322ecf294a4129871b055af71e8;hb=refs/heads/tizen_2.3

Refer upper source. it's tizen 2.3 mobile Elementary widget system theme.

If you want make some new standard icon, you can use elm_theme_extension_add and make your theme for elm_icon

Especially, icon is not child of (wrapper of) layout so you can't use elm_layout_theme_set. (other layout base widget can use this function for change theme)

And I think Elementary widget's custom theme system is not good.

If you want to make new theme, you must know about undocumented style naming rule.

Refer my comment in https://developer.tizen.org/forums/native-application-development/change-theme-background-color

In icon theme, you should be make group named like "elm/icon/[Name]/default"