EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *bx, *tb, *bt, *menu; Elm_Object_Item *tb_it; win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC); elm_win_title_set(win, "Toolbar Example"); evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); bx = elm_box_add(win); elm_win_resize_object_add(win, bx); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(bx); bt = elm_button_add(win); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(bt, "Button"); evas_object_show(bt); tb = elm_toolbar_add(win); evas_object_size_hint_weight_set(tb, 0.0, 0.0); evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); evas_object_show(tb); elm_toolbar_item_append(tb, "document-print", "Print", NULL, NULL); elm_toolbar_item_append(tb, "folder-new", "Folder", NULL, NULL); elm_toolbar_item_append(tb, "clock", "Clock", NULL, NULL); elm_toolbar_item_append(tb, "refresh", "Update", NULL, NULL); elm_toolbar_menu_parent_set(tb, win); tb_it = elm_toolbar_item_append(tb, "mail-send", "Send Mail", NULL, NULL); elm_toolbar_item_menu_set(tb_it, EINA_TRUE); menu = elm_toolbar_item_menu_get(tb_it); elm_menu_item_add(menu, NULL, "emptytrash", "Empty Trash", NULL, NULL); elm_menu_item_add(menu, NULL, "trashcan_full", "Full Trash", NULL, NULL); elm_toolbar_item_priority_set(tb_it, 10); elm_box_pack_end(bx, tb); elm_box_pack_end(bx, bt); evas_object_resize(win, 230, 200); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bx, *tb, *bt, *menu; Elm_Object_Item *tb_it; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("toolbar", "Toolbar Example"); elm_win_autodel_set(win, EINA_TRUE); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bx); evas_object_show(bx); bt = elm_button_add(win); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(bt, "Button"); evas_object_show(bt); tb = elm_toolbar_add(win); evas_object_size_hint_weight_set(tb, 0.0, 0.0); evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0); evas_object_show(tb); elm_toolbar_item_append(tb, "document-print", "Print", NULL, NULL); elm_toolbar_item_append(tb, "folder-new", "Folder", NULL, NULL); elm_toolbar_item_append(tb, "clock", "Clock", NULL, NULL); elm_toolbar_item_append(tb, "refresh", "Update", NULL, NULL); elm_toolbar_menu_parent_set(tb, win); tb_it = elm_toolbar_item_append(tb, "mail-send", "Send Mail", NULL, NULL); elm_toolbar_item_menu_set(tb_it, EINA_TRUE); menu = elm_toolbar_item_menu_get(tb_it); elm_menu_item_add(menu, NULL, "emptytrash", "Empty Trash", NULL, NULL); elm_menu_item_add(menu, NULL, "trashcan_full", "Full Trash", NULL, NULL); elm_toolbar_item_priority_set(tb_it, 10); elm_box_pack_end(bx, tb); elm_box_pack_end(bx, bt); evas_object_resize(win, 230, 200); evas_object_show(win); elm_run(); return 0; }
//--// public routines Evas_Object * snippets_add(Evas_Object *win) { Evas_Object *tb; // add toolbar to main win tb = elm_toolbar_add(win); elm_toolbar_menu_parent_set(tb, win); // FIXME: fill the toolbar elm_toolbar_item_append(tb, "default", "To Fill", NULL, NULL); return tb; }
EAPI_MAIN int elm_main(int argc, char *argv[]) { Evas_Object *win, *bg, *box, *box2, *btn, *ic, *url, *naviframe, *tabs, *web; Evas *e; Evas_Modifier_Mask ctrl_mask; App_Data *ad; if (!elm_need_web()) return -1; ad = calloc(1, sizeof(App_Data)); if (!ad) return -1; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_add(NULL, "example-web", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); e = evas_object_evas_get(win); ctrl_mask = evas_key_modifier_mask_get(e, "Control"); if (!evas_object_key_grab(win, "f", ctrl_mask, 0, EINA_TRUE)) fprintf(stderr, "Could not grab trigger for search dialog\n"); evas_object_smart_callback_add(win, "delete,request", _win_del_request_cb, ad); evas_object_event_callback_add(win, EVAS_CALLBACK_KEY_DOWN, _win_search_trigger_cb, ad); evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _win_free_cb, ad); bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); box = elm_box_add(win); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, box); evas_object_show(box); url = elm_entry_add(win); elm_entry_single_line_set(url, EINA_TRUE); elm_entry_scrollable_set(url, EINA_TRUE); evas_object_size_hint_weight_set(url, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(url, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, url); evas_object_show(url); evas_object_smart_callback_add(url, "activated", _url_activated_cb, ad); box2 = elm_box_add(win); elm_box_horizontal_set(box2, EINA_TRUE); elm_object_part_content_set(url, "icon", box2); elm_entry_icon_visible_set(url, EINA_FALSE); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ad->nav.back = btn; ic = elm_icon_add(win); elm_icon_standard_set(ic, "arrow_left"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _nav_back_cb, ad); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ad->nav.refresh = btn; ic = elm_icon_add(win); elm_icon_standard_set(ic, "refresh"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _nav_refresh_cb, ad); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ad->nav.fwd = btn; ic = elm_icon_add(win); elm_icon_standard_set(ic, "arrow_right"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _nav_fwd_cb, ad); box2 = elm_box_add(win); elm_box_horizontal_set(box2, EINA_TRUE); evas_object_size_hint_weight_set(box2, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, box2); evas_object_show(box2); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); ic = elm_icon_add(win); elm_icon_standard_set(ic, "file"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _add_tab_cb, ad); tabs = elm_toolbar_add(win); elm_toolbar_align_set(tabs, 0.0); elm_toolbar_select_mode_set(tabs, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_toolbar_homogeneous_set(tabs, EINA_FALSE); elm_toolbar_shrink_mode_set(tabs, ELM_TOOLBAR_SHRINK_MENU); evas_object_size_hint_weight_set(tabs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(tabs, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box2, tabs); evas_object_show(tabs); btn = elm_button_add(win); elm_box_pack_end(box2, btn); evas_object_show(btn); evas_object_smart_callback_add(btn, "clicked", _close_tab_cb, ad); ic = elm_icon_add(win); elm_icon_standard_set(ic, "close"); elm_object_part_content_set(btn, "icon", ic); naviframe = elm_naviframe_add(win); evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, naviframe); evas_object_show(naviframe); elm_toolbar_menu_parent_set(tabs, naviframe); web = elm_web_add(win); elm_web_window_create_hook_set(web, _web_create_window_cb, ad); elm_web_history_enabled_set(web, EINA_FALSE); evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(web, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_naviframe_item_simple_push(naviframe, web); default_content_set(web); ad->win = win; ad->main_box = box; ad->naviframe = naviframe; ad->url = url; ad->default_web = web; ad->tabs = tabs; ad->close_tab = btn; evas_object_resize(win, 480, 640); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }