The view_create_grid_and_content() function creates a panel for 10 buttons and 3 entries for displaying the result:
static Evas_Object*
view_create_grid_and_content(Evas_Object *nf, appdata_s *ad)
{
/* Create and initialize elm_grid */
Evas_Object *grid = NULL;
if (nf == NULL) {
dlog_print(DLOG_ERROR, LOG_TAG, "naviframe is NULL.");
return NULL;
}
grid = elm_grid_add(nf);
evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_content_set(nf, grid);
/* Entry for the API name */
s_info.entry = create_entry(grid);
elm_grid_pack(grid, s_info.entry, 0, 5, 90, 10);
/* Entry for the API result */
s_info.event_entry = create_entry(grid);
elm_grid_pack(grid, s_info.event_entry, 0, 15, 90, 10);
/* Entry for the fence state */
s_info.state_entry = create_entry(grid);
elm_grid_pack(grid, s_info.state_entry, 0, 25, 90, 10);
/* Entry for the proximity state */
s_info.proximity_entry = create_entry(grid);
elm_grid_pack(grid, s_info.proximity_entry, 0, 35, 90, 10);
/* Create the panel */
Evas_Object *panel = create_panel_and_content(grid, ad);
elm_grid_pack(grid, panel, 0, 55, 100, 45);
return grid;
}
The create_panel_basic_content() function creates 10 buttons:
static Evas_Object*
create_panel_basic_content(Evas_Object *panel, appdata_s *ad)
{
/* Create and initialize elm_table */
Evas_Object *table;
if (panel == NULL) {
dlog_print(DLOG_ERROR, LOG_TAG, "panel is NULL.");
return NULL;
}
table = elm_table_add(parent);
elm_table_padding_set(table, 10, 0);
/* Create the buttons */
/* "Create" button */
ad->create_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->create_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->create_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->create_btn, "<font_size=30>Create</font_size>");
elm_object_disabled_set(ad->create_btn, EINA_FALSE);
evas_object_smart_callback_add(ad->create_btn, "clicked", clicked_create_cb, ad);
evas_object_show(ad->create_btn);
elm_table_pack(table, ad->create_btn, 0, 0, 1, 1);
/* "Fence Status" button */
ad->fence_status_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->fence_status_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->fence_status_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->fence_status_btn, "<font_size=30>Fence Status</font_size>");
elm_object_disabled_set(ad->fence_status_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->fence_status_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->fence_status_btn);
elm_table_pack(table, ad->fence_status_btn, 1, 0, 1, 1);
/* "Add Fence" button */
ad->add_fence_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->add_fence_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->add_fence_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->add_fence_btn, "<font_size=30>Add Fence</font_size>");
elm_object_disabled_set(ad->add_fence_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->add_fence_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->add_fence_btn);
elm_table_pack(table, ad->add_fence_btn, 0, 1, 1, 1);
/* "Add Place" button */
ad->add_place_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->add_place_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->add_place_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->add_place_btn, "<font_size=30>Add Place</font_size>");
elm_object_disabled_set(ad->add_place_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->add_place_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->add_place_btn);
elm_table_pack(table, ad->add_place_btn, 1, 1, 1, 1);
/* "Start" button */
ad->start_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->start_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->start_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->start_btn, "<font_size=30>Start</font_size>");
elm_object_disabled_set(ad->start_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->start_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->start_btn);
elm_table_pack(table, ad->start_btn, 0, 2, 1, 1);
/* "Stop" button */
ad->stop_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->stop_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->stop_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->stop_btn, "<font_size=30>Stop</font_size>");
elm_object_disabled_set(ad->stop_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->stop_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->stop_btn);
elm_table_pack(table, ad->stop_btn, 1, 2, 1, 1);
/* "Remove Fence" button */
ad->remove_fence_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->remove_fence_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->remove_fence_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->remove_fence_btn, "<font_size=30>Remove Fence</font_size>");
elm_object_disabled_set(ad->remove_fence_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->remove_fence_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->remove_fence_btn);
elm_table_pack(table, ad->remove_fence_btn, 0, 3, 1, 1);
/* "Remove Place" button */
ad->remove_place_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->remove_place_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->remove_place_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->remove_place_btn, "<font_size=30>Remove Place</font_size>");
elm_object_disabled_set(ad->remove_place_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->remove_place_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->remove_place_btn);
elm_table_pack(table, ad->remove_place_btn, 1, 3, 1, 1);
/* "Update Place" button */
ad->update_place_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->update_place_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->update_place_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->update_place_btn, "<font_size=30>Update Place</font_size>");
elm_object_disabled_set(ad->update_place_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->update_place_btn, "clicked", show_popup_cb, ad);
evas_object_show(ad->update_place_btn);
elm_table_pack(table, ad->update_place_btn, 0, 4, 1, 1);
/* "Destroy" button */
ad->destroy_btn = elm_button_add(table);
evas_object_size_hint_weight_set(ad->destroy_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ad->destroy_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(ad->destroy_btn, "<font_size=30>Destroy</font_size>");
elm_object_disabled_set(ad->destroy_btn, EINA_TRUE);
evas_object_smart_callback_add(ad->destroy_btn, "clicked", clicked_destroy_cb, ad);
evas_object_show(ad->destroy_btn);
elm_table_pack(table, ad->destroy_btn, 1, 4, 1, 1);
evas_object_show(table);
return table;
}