elm_bubble - Simple use.

- Main Page
- Related Pages
- Data Structures
- Files
- Examples

elm_bubble - Simple use.

This example shows a bubble with all fields set(label, info, content and icon) and the selected corner changing when the bubble is clicked. To be able use a bubble we need to do some setup and create a window, for this example we are going to ignore that part of the code since it isn't relevant to the bubble.

To have the selected corner change in a clockwise motion we are going to use the following callback:

static unsigned char corner = 0;
++corner;
if (corner > 3)
elm_bubble_pos_set(obj, ELM_BUBBLE_POS_TOP_LEFT);
else
elm_bubble_pos_set(obj, corner);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *bubble, *label, *icon;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("bubble", "Bubble");
elm_win_autodel_set(win, EINA_TRUE);
label = elm_label_add(win);
elm_object_text_set(label, "This is the CONTENT of our bubble");
evas_object_show(label);
icon = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_color_set(icon, 0, 0, 255, 255);
evas_object_show(icon);
bubble = elm_bubble_add(win);
elm_object_part_content_set(bubble, "icon", icon);
elm_object_part_text_set(bubble, "info", "INFO");
elm_object_text_set(bubble, "LABEL");
elm_object_content_set(bubble, label);
evas_object_resize(bubble, 300, 100);
evas_object_show(bubble);
evas_object_smart_callback_add(bubble, "clicked", _bla, NULL);
label = elm_label_add(win);
elm_object_text_set(label, "Bubble with no icon, info or label");
evas_object_show(label);
bubble = elm_bubble_add(win);
elm_object_content_set(bubble, label);
evas_object_resize(bubble, 200, 50);
evas_object_move(bubble, 0, 110);
evas_object_show(bubble);
evas_object_resize(win, 300, 200);
evas_object_show(win);
elm_run();
return 0;
}

Here we are creating an elm_label that is going to be used as the content for our bubble:

Note
  You could use any evas_object for this, we are using an elm_label for simplicity.

Despite it's name the bubble's icon doesn't have to be an icon, it can be any evas_object. For this example we are going to make the icon a simple blue rectangle:

And finally we have the actual bubble creation and the setting of it's label, info and content:

Note
  Because we didn't set a corner, the default("top_left") will be used.

Now that we have our bubble all that is left is connecting the "clicked" signals to our callback:

This last bubble we created was very complete, so it's pertinent to show that most of that stuff is optional a bubble can be created with nothing but content:

Our example will look like this:

See the full source code bubble_example_01.c here.