Tizen(Headed) Native API
6.5
|
In this example we add three buttons to a relative_container.
- The first button is positioned at left-top of the relative_container by set only right and bottom.
elm_relative_container_relation_right_set(layout, bt1, layout, 0.0); elm_relative_container_relation_bottom_set(layout, bt1, layout, 0.0);
- The second button is positioned at right-bottom of the relative_container by set only left and top.
elm_relative_container_relation_left_set(layout, bt2, layout, 1.0); elm_relative_container_relation_top_set(layout, bt2, layout, 1.0);
- The last one is positioned between first and second button. it changes all of edges.
elm_relative_container_relation_left_set(layout, bt3, bt1, 1.0); elm_relative_container_relation_top_set(layout, bt3, bt1, 1.0); elm_relative_container_relation_right_set(layout, bt3, bt2, 0.0); elm_relative_container_relation_bottom_set(layout, bt3, bt2, 0.0);
Here you can see the full source:
// gcc -o relative_container_example_01 relative_container_example_01.c `pkg-config --cflags --libs elementary` #include <Elementary.h> EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *layout, *bt1, *bt2, *bt3; win = elm_win_util_standard_add("elm-relative-container", "Elm.RelativeContainer"); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); evas_object_resize(win, 500, 500); evas_object_show(win); layout = elm_relative_container_add(win); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(layout); elm_win_resize_object_add(win, layout); bt1 = elm_button_add(layout); bt2 = elm_button_add(layout); bt3 = elm_button_add(layout); elm_object_text_set(bt1, "bt1"); evas_object_size_hint_min_set(bt1, 100, 100); evas_object_size_hint_align_set(bt1, 0.0, 0.0); evas_object_show(bt1); elm_relative_container_relation_right_set(layout, bt1, layout, 0.0); elm_relative_container_relation_bottom_set(layout, bt1, layout, 0.0); elm_object_text_set(bt2, "bt2"); evas_object_size_hint_min_set(bt2, 200, 200); evas_object_size_hint_align_set(bt2, 1.0, 1.0); evas_object_show(bt2); elm_relative_container_relation_left_set(layout, bt2, layout, 1.0); elm_relative_container_relation_top_set(layout, bt2, layout, 1.0); elm_object_text_set(bt3, "bt3"); evas_object_size_hint_min_set(bt3, 100, 100); evas_object_size_hint_align_set(bt3, 0.0, 1.0); evas_object_show(bt3); elm_relative_container_relation_left_set(layout, bt3, bt1, 1.0); elm_relative_container_relation_top_set(layout, bt3, bt1, 1.0); elm_relative_container_relation_right_set(layout, bt3, bt2, 0.0); elm_relative_container_relation_bottom_set(layout, bt3, bt2, 0.0); elm_run(); return 0; } ELM_MAIN()