Elementary bubble widget

This code snippet demonstrates how to use bubble widget. Two bubbles with different parameters are created and placed inside a box.
static void bubble_test(Evas_Object *parent) {
	//box for the bubbles
	Evas_Object *box = elm_box_add(parent);
	evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(parent, box);
	evas_object_show(box);

	//FIRST BUBBLE

	//create label
	Evas_Object *label_john = elm_label_add(parent);
	elm_object_text_set(label_john, "Hello!");
	evas_object_show(label_john);

	//create bubble
	Evas_Object *bubble_john = elm_bubble_add(parent);
	evas_object_size_hint_align_set(bubble_john, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_pack_end(box, bubble_john);
	evas_object_show(bubble_john);

	//set info, text and content
	elm_object_part_text_set(bubble_john, "info", "today, 12:05");
	elm_object_text_set(bubble_john, "John");
	elm_object_content_set(bubble_john, label_john);


	//SECOND BUBBLE

	Evas_Object *label_mary = elm_label_add(parent);
	elm_object_text_set(label_mary, "Hi!");
	evas_object_show(label_mary);

	Evas_Object *bubble_mary = elm_bubble_add(parent);
	evas_object_size_hint_align_set(bubble_mary, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_pack_end(box, bubble_mary);
	evas_object_show(bubble_mary);

	//change arrow position
	elm_bubble_pos_set(bubble_mary, ELM_BUBBLE_POS_TOP_RIGHT);
	elm_object_part_text_set(bubble_mary, "info", "today, 12:06");
	elm_object_text_set(bubble_mary, "Mary");
	elm_object_content_set(bubble_mary, label_mary);
}

Responses

0 Replies