Elementary mapbuf widget

This code snippet shows how to use mapbuf widget from the Elementary library.
static void mapbuf_test(Evas_Object *parent) {
	//create a mapbuf object
	Evas_Object *mapbuf = elm_mapbuf_add(parent);
	elm_win_resize_object_add(parent, mapbuf);
	evas_object_show(mapbuf);

	//create a table
	Evas_Object *table = elm_table_add(parent);
	elm_win_resize_object_add(parent, table);
	evas_object_show(table);

	//populate table with home icons
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 6; j++) {
			Evas_Object *icon = elm_icon_add(parent);
			elm_icon_standard_set(icon, "home");
			elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE);
			evas_object_show(icon);
			elm_table_pack(table, icon, i, j, 1, 1);
		}
	}

	//set table as mapbuf's content
	elm_object_content_set(mapbuf, table);

	//enable map (default is disabled)
	elm_mapbuf_enabled_set(mapbuf, EINA_TRUE);
}

Responses

0 Replies