Elementary icon widget

This code snippet shows how to use elementary icon widget.
static void add_to_box(Evas_Object *icon, Evas_Object *box) {
	evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_pack_end(box, icon);
}

static void icon_test(Evas_Object *parent) {
	Evas_Object *box = elm_box_add(parent);
	elm_win_resize_object_add(parent, box);
	evas_object_show(box);

	//HOME ICON
	Evas_Object * icon_home = elm_icon_add(parent);
	add_to_box(icon_home, box);

	//look for the icon in theme first
	elm_icon_order_lookup_set(icon_home, ELM_ICON_LOOKUP_THEME_FDO);

	//set icon name
	elm_icon_standard_set(icon_home, "home");

	//disable icon resizing
	elm_image_resizable_set(icon_home, EINA_FALSE, EINA_FALSE);

	//CLOCK ICON
	Evas_Object * icon_clock = elm_icon_add(parent);
	add_to_box(icon_clock, box);

	//look for the icon in freedesktop first
	elm_icon_order_lookup_set(icon_clock, ELM_ICON_LOOKUP_FDO_THEME);

	//set icon name
	elm_icon_standard_set(icon_clock, "clock");

	//fill the whole parent
	elm_image_fill_outside_set(icon_clock, EINA_TRUE);

	//use better scaling algorithm (slower)
	elm_image_smooth_set(icon_clock, EINA_TRUE);

	evas_object_show(icon_home);
	evas_object_show(icon_clock);
}

Responses

0 Replies