static Evas_Object* _add_entry ( Evas_Object *window, Evas_Object *container, const gchar *label_text) { Evas_Object *frame = NULL; Evas_Object *entry = NULL; if (label_text) { frame = elm_frame_add(window); elm_object_text_set(frame, label_text); evas_object_size_hint_weight_set(frame, 0.0, 0.0); evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(container, frame); evas_object_show(frame); } entry = elm_entry_add (window); elm_entry_single_line_set (entry, EINA_TRUE); elm_entry_scrollable_set (entry, EINA_TRUE); evas_object_size_hint_min_set (entry, 150, 80); evas_object_size_hint_align_set (entry, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0); frame ? elm_object_content_set (frame, entry) : elm_box_pack_end (container, entry); return entry; }
END_TEST START_TEST (elm_entry_atspi_text_string_get_line) { Evas_Object *win, *entry; char *val; int start, end; const char *txt = "Lorem ipśum<br> dolor sit amęt"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); evas_object_resize(entry, 500, 500); elm_object_text_set(entry, txt); start = 1; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_LINE, &start, &end)); ck_assert_str_eq(val, "Lorem ipśum"); ck_assert(start == 0); ck_assert(end == 11); if (val) free(val); start = 13; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_LINE, &start, &end)); ck_assert_str_eq(val, " dolor sit amęt"); ck_assert(start == 12); ck_assert(end == 29); if (val) free(val); elm_shutdown(); }
Evas_Object *common_utils_add_edit_box(Evas_Object *parent, const common_utils_entry_info_t *entry_info) { Evas_Object *layout = elm_layout_add(parent); Evas_Object *entry = NULL; elm_layout_theme_set(layout, "layout", "editfield", "title"); 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); elm_object_part_text_set(layout, "elm.text", entry_info->title); elm_object_part_text_set(layout, "elm.guidetext", entry_info->guide_txt); // Set guidetext. entry = elm_entry_add(layout); elm_object_part_content_set(layout, "elm.swallow.content", entry); elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_scrollable_set(entry, EINA_TRUE); elm_entry_entry_set(entry, entry_info->entry_txt); elm_entry_input_panel_layout_set(entry, entry_info->panel_type); if (!elm_entry_is_empty(entry)) { INFO_LOG(UG_NAME_NORMAL, "entry is not empty"); elm_object_signal_emit(layout, "elm,state,guidetext,hide", "elm"); if (!entry_info->guide_txt || strlen(entry_info->guide_txt) <= 0) evas_object_data_set(layout, COMMON_UTILS_DEFAULT_ENTRY_TEXT_KEY, g_strdup(entry_info->entry_txt)); } evas_object_smart_callback_add(entry, "changed", __common_utils_entry_changed_cb, layout); evas_object_smart_callback_add(entry, "focused", __common_utils_entry_focused_cb, layout); evas_object_smart_callback_add(entry, "unfocused", __common_utils_entry_unfocused_cb, layout); elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", __common_utils_eraser_clicked_cb, entry); evas_object_show(entry); return layout; }
SH_API Evas_Object * create_entry(Evas_Object *parent, Eina_Bool entry_has_one_line, const char *entry_text, Eina_Bool entry_hide_text, Eina_Bool entry_line_nowrap, Eina_Bool entry_editable) { Evas_Object *entry; char *s = NULL; if (entry_text) s = elm_entry_utf8_to_markup(entry_text); entry = elm_entry_add(parent); if (entry_line_nowrap) elm_entry_line_wrap_set(entry, 0); else elm_entry_line_wrap_set(entry, 1); if (s) { elm_entry_entry_set(entry, s); E_FREE(s); } elm_entry_password_set(entry, entry_hide_text); evas_object_size_hint_weight_set(entry, 1.0, 1.0); evas_object_size_hint_align_set(entry, -1.0, -1.0); elm_entry_single_line_set(entry, entry_has_one_line); elm_entry_editable_set(entry, entry_editable); return entry; }
END_TEST START_TEST (elm_entry_atspi_text_text_get) { Evas_Object *win, *entry; char *val; const char *txt = "Lorem Xpśum dolor sit amęt"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); elm_object_text_set(entry, txt); // invalid ranges eo_do(entry, val = elm_interface_atspi_text_get(6, 100)); ck_assert(val == NULL); eo_do(entry, val = elm_interface_atspi_text_get(-6, 10)); ck_assert(val == NULL); eo_do(entry, val = elm_interface_atspi_text_get(-6, -10)); ck_assert(val == NULL); eo_do(entry, val = elm_interface_atspi_text_get(60, 100)); ck_assert(val == NULL); // proper range eo_do(entry, val = elm_interface_atspi_text_get(6, 17)); ck_assert_str_eq(val, "Xpśum dolor"); if (val) free(val); elm_shutdown(); }
static void frame_number_add_show(struct MessageNewViewData *data) { struct Window *win = data->win; window_layout_set(win, MESSAGE_FILE, "recipient_number_add"); window_text_set(win, "title", D_("Add a Number")); data->bt1 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt1, D_("Back")); evas_object_smart_callback_add(data->bt1, "clicked", frame_number_add_back_clicked, data); window_swallow(win, "button_back", data->bt1); evas_object_show(data->bt1); data->bt2 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt2, D_("Add")); evas_object_smart_callback_add(data->bt2, "clicked", frame_number_add_add_clicked, data); window_swallow(win, "button_add", data->bt2); evas_object_show(data->bt2); data->entry = elm_entry_add(window_evas_object_get(win)); evas_object_show(data->entry); elm_widget_focus_set(data->entry, 1); data->sc = elm_scroller_add(window_evas_object_get(win)); elm_scroller_content_set(data->sc, data->entry); window_swallow(win, "entry", data->sc); evas_object_show(data->sc); window_kbd_show(win, KEYBOARD_NUMERIC); }
EINA_DEPRECATED EAPI Evas_Object * elm_scrolled_entry_add(Evas_Object *parent) { Evas_Object *obj; obj = elm_entry_add(parent); elm_entry_scrollable_set(obj, EINA_TRUE); return obj; }
static void _init_content_page(struct MessageNewViewData *view) { Evas_Object *win, *btn; win = ui_utils_view_window_get(VIEW_PTR(*view)); view->layout_content = elm_layout_add(win); elm_win_resize_object_add(win, view->layout_content); evas_object_size_hint_weight_set(view->layout_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_layout_file_set(view->layout_content, phoneui_theme, "phoneui/messages/new/content"); evas_object_show(view->layout_content); edje_object_part_text_set(elm_layout_edje_get(view->layout_content), "content_title", D_("Enter your message")); view->content_entry = elm_entry_add(win); elm_entry_scrollable_set(view->content_entry, EINA_TRUE); evas_object_smart_callback_add(view->content_entry, "changed", _content_changed, view); if (view->content != NULL) { elm_entry_entry_set(view->content_entry, elm_entry_utf8_to_markup(view->content)); } evas_object_show(view->content_entry); elm_object_part_content_set(view->layout_content, "content_entry", view->content_entry); elm_object_focus_set(view->content_entry, EINA_TRUE); btn = elm_button_add(win); elm_object_text_set(btn, D_("Insert")); evas_object_smart_callback_add(btn, "clicked", _content_button_insert_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_insert", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Close")); evas_object_smart_callback_add(btn, "clicked", _content_button_close_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_close", btn); evas_object_show(btn); btn = elm_button_add(win); elm_object_text_set(btn, D_("Continue")); evas_object_smart_callback_add(btn, "clicked", _content_button_continue_clicked, view); elm_object_part_content_set(view->layout_content, "content_button_continue", btn); evas_object_show(btn); elm_naviframe_item_simple_push(view->pager, view->layout_content); }
// Create Window static void Build_Window () { // Create window named Main_Win Window *Main_Win = malloc(sizeof(Window)) ; //Create window printf("Create window\n") ; Main_Win->win = elm_win_add(NULL, "main_window", ELM_WIN_BASIC); evas_object_smart_callback_add(Main_Win->win, "delete,request", win_del, Main_Win); elm_win_title_set(Main_Win->win, "MyTest") ; evas_object_resize(Main_Win->win, 500, 500) ; evas_object_show(Main_Win->win); //Create background printf("Create background\n") ; Main_Win->bg = elm_bg_add(Main_Win->win); elm_win_resize_object_add(Main_Win->win, Main_Win->bg) ; elm_bg_color_set(Main_Win->bg, 10, 90, 200) ; evas_object_size_hint_weight_set(Main_Win->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) ; evas_object_show(Main_Win->bg); //Create Buttons printf("Create Button\n") ; Main_Win->btn_con = elm_button_add(Main_Win->win) ; evas_object_move(Main_Win->btn_con, 10, 10) ; evas_object_resize(Main_Win->btn_con, 100, 30) ; elm_object_text_set(Main_Win->btn_con, "Connect") ; evas_object_show(Main_Win->btn_con) ; Main_Win->btn_disc = elm_button_add(Main_Win->win) ; evas_object_move(Main_Win->btn_disc, 10, 50) ; evas_object_resize(Main_Win->btn_disc, 100, 30) ; elm_object_text_set(Main_Win->btn_disc, "Disconnect") ; evas_object_show(Main_Win->btn_disc) ; elm_object_disabled_set(Main_Win->btn_disc, EINA_TRUE) ; //Create Entrys printf("Create entry\n") ; Main_Win->ip = elm_entry_add(Main_Win->win) ; evas_object_move(Main_Win->ip, 120, 120) ; evas_object_resize(Main_Win->ip, 100, 30) ; elm_object_text_set (Main_Win->ip, "127.0.0.1") ; elm_entry_scrollable_set(Main_Win->ip, EINA_TRUE) ; elm_object_tooltip_text_set(Main_Win->ip, "Coucou") ; evas_object_show(Main_Win->ip) ; // Link Buttons Functions evas_object_smart_callback_add(Main_Win->btn_con, "clicked", btn_connect, Main_Win) ; evas_object_smart_callback_add(Main_Win->btn_disc, "clicked", btn_disconnect, Main_Win) ; }
void GLViewImpl::setIMEKeyboardState(bool open) { if (open) { if (!s_keypadWin) { auto frameSize = Director::getInstance()->getOpenGLView()->getFrameSize(); auto app = Application::getInstance(); s_keypadWin = elm_win_add(app->_win, "cocos2d-x textfield", ELM_WIN_BASIC); elm_win_autodel_set(s_keypadWin, EINA_TRUE); elm_win_conformant_set(s_keypadWin, EINA_TRUE); elm_win_alpha_set(s_keypadWin, EINA_TRUE); eext_object_event_callback_add(s_keypadWin, EEXT_CALLBACK_BACK, keyPadBackCallback, NULL); evas_object_show(s_keypadWin); int rots[2]; rots[0] = (int)elm_win_rotation_get(app->_win); rots[1] = rots[0] + 180 % 360; elm_win_wm_rotation_available_rotations_set(s_keypadWin, rots, 2); auto rectangle = elm_bg_add(s_keypadWin); evas_object_resize(rectangle, frameSize.width, frameSize.height + 50); evas_object_color_set(rectangle, 0xff, 0xff, 0xff, 0); evas_object_move(rectangle, 0, -50); evas_object_show(rectangle); evas_object_repeat_events_set(rectangle, EINA_TRUE); evas_object_event_callback_add(rectangle, EVAS_CALLBACK_MOUSE_UP, blankAreaClickedCallback, NULL); evas_object_event_callback_add(rectangle, EVAS_CALLBACK_MULTI_UP, blankAreaClickedCallback, NULL); s_keypadEntry = elm_entry_add(rectangle); elm_entry_single_line_set(s_keypadEntry, EINA_TRUE); evas_object_resize(s_keypadEntry, frameSize.width, 50); evas_object_move(s_keypadEntry, 0, -50); elm_entry_input_panel_return_key_type_set(s_keypadEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); elm_entry_prediction_allow_set(s_keypadEntry, EINA_FALSE); evas_object_event_callback_add(s_keypadEntry, EVAS_CALLBACK_KEY_UP, entryKeyCallback, NULL); evas_object_show(s_keypadEntry); elm_object_focus_set(s_keypadEntry, EINA_TRUE); evas_object_smart_callback_add(s_keypadEntry, "activated", entryActivatedCallback, NULL); elm_entry_input_panel_show(s_keypadEntry); s_imf = (Ecore_IMF_Context*)elm_entry_imf_context_get(s_keypadEntry); ecore_imf_context_event_callback_add(s_imf, ECORE_IMF_CALLBACK_COMMIT, imfEventCommitCallback, s_keypadEntry); } } else if (s_keypadWin) { closeKeypad(); } }
EAPI int elm_main(int argc, char **argv) { Evas_Object *win, *o, *bg, *box; Ecore_Event_Handler *handle_key_up, *handle_key_down; win = elm_win_add(NULL, "elm_event", ELM_WIN_BASIC); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); o = elm_bg_add(win); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, o); evas_object_show(o); box = elm_box_add(win); elm_box_horizontal_set(box, EINA_FALSE); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, box); evas_object_show(box); o = elm_entry_add(win); elm_entry_single_line_set(o, EINA_TRUE); elm_entry_entry_set(o, "123ab456"); elm_box_pack_end(box, o); evas_object_show(o); o = elm_button_add(win); elm_object_text_set(o, "Test"); elm_box_pack_end(box, o); evas_object_show(o); handle_key_up = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _input_event_cb, NULL); handle_key_down = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _input_event_cb, NULL); evas_object_resize(win, 300, 300); evas_object_show(win); elm_run(); if (handle_key_up) ecore_event_handler_del(handle_key_up); if (handle_key_down) ecore_event_handler_del(handle_key_down); elm_shutdown(); return 0; }
static void utc_UIFW_elm_entry_cursor_down_func_01(void) { test_eo = NULL; Eina_Bool flag = EINA_FALSE; test_eo = elm_entry_add(test_win); elm_entry_entry_set(test_eo, "a<br>b<br>c"); elm_entry_cursor_up(test_eo); flag = elm_entry_cursor_down(test_eo); TET_CHECK_PASS(EINA_FALSE, flag); tet_result(TET_PASS); tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_entry_cursor_down"); }
static void _initialize_and_show_buttons(Evas_Object *win) { Evas_Object *bg = NULL, *entry = NULL; 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); entry = elm_entry_add(win); elm_entry_entry_set(entry, EAIL_TEST_ENTRY_NAME); evas_object_resize(entry, 100, 60); evas_object_move(entry, 50, 20); evas_object_show(entry); }
END_TEST START_TEST (elm_entry_atspi_text_selections) { Evas_Object *win, *entry; int val, start, end; const char *str; Eina_Bool ret; const char *txt = "Lorem ipśum<br> dolor sit\n amęt"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); elm_object_text_set(entry, txt); eo_do(entry, val = elm_interface_atspi_text_selections_count_get()); ck_assert(val == 0); elm_entry_select_region_set(entry, 2, 4); eo_do(entry, val = elm_interface_atspi_text_selections_count_get()); ck_assert(val == 1); eo_do(entry, elm_interface_atspi_text_selection_get(0, &start, &end)); ck_assert(start == 2); ck_assert(end == 4); elm_entry_select_region_set(entry, 6, 10); eo_do(entry, val = elm_interface_atspi_text_selections_count_get()); ck_assert(val == 1); eo_do(entry, elm_interface_atspi_text_selection_get(0, &start, &end)); ck_assert(start == 6); ck_assert(end == 10); elm_entry_select_none(entry); eo_do(entry, ret = elm_interface_atspi_text_selection_add(2, 5)); ck_assert(ret == EINA_TRUE); str = elm_entry_selection_get(entry); ck_assert_str_eq(str, "rem"); eo_do(entry, ret = elm_interface_atspi_text_selection_remove(0)); ck_assert(ret == EINA_TRUE); str = elm_entry_selection_get(entry); ck_assert(str == NULL); elm_shutdown(); }
END_TEST START_TEST (elm_atspi_role_get) { Evas_Object *win, *entry; Elm_Atspi_Role role; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); eo_do(entry, role = elm_interface_atspi_accessible_role_get()); ck_assert(role == ELM_ATSPI_ROLE_ENTRY); elm_shutdown(); }
static Evas_Object * _widget_entry_create(const char* style) { char buf[PATH_MAX]; Evas_Object *o; o = elm_entry_add(win); EXPAND(o); FILL(o); elm_object_style_set(o, style); snprintf(buf, sizeof(buf), "This is an entry widget in this window that<br/>" "uses markup <b>like this</> for styling and<br/>"); elm_object_text_set(o, buf); evas_object_show(o); return o; }
END_TEST START_TEST (elm_entry_atspi_text_string_get_word) { Evas_Object *win, *entry; char *val; int start, end; const char *txt = "Lorem ipśum dolor sit amęt"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); elm_object_text_set(entry, txt); start = 1; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_WORD, &start, &end)); ck_assert_str_eq(val, "Lorem"); ck_assert(start == 0); ck_assert(end == 5); if (val) free(val); start = 6; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_WORD, &start, &end)); ck_assert_str_eq(val, "ipśum"); ck_assert(start == 6); ck_assert(end == 11); if (val) free(val); start = 19; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_WORD, &start, &end)); ck_assert_str_eq(val, "dolor"); ck_assert(start == 14); ck_assert(end == 19); if (val) free(val); start = 111; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_WORD, &start, &end)); ck_assert(start == -1); ck_assert(end == -1); ck_assert(val == NULL); if (val) free(val); elm_shutdown(); }
END_TEST START_TEST (elm_entry_atspi_text_string_get_paragraph) { Evas_Object *win, *entry; char *val; int start, end; const char *txt = "Lorem ipśum<br> dolor sit<br> amęt"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); elm_object_text_set(entry, txt); start = 1; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_PARAGRAPH, &start, &end)); ck_assert_str_eq(val, "Lorem ipśum"); ck_assert(start == 0); ck_assert(end == 11); if (val) free(val); start = 20; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_PARAGRAPH, &start, &end)); ck_assert_str_eq(val, " dolor sit"); ck_assert(start == 12); ck_assert(end == 24); if (val) free(val); start = 25; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_PARAGRAPH, &start, &end)); ck_assert_str_eq(val, " amęt"); ck_assert(start == 25); ck_assert(end == 30); if (val) free(val); start = 111; eo_do(entry, val = elm_interface_atspi_text_string_get(ELM_ATSPI_TEXT_GRANULARITY_WORD, &start, &end)); ck_assert(start == -1); ck_assert(end == -1); ck_assert(val == NULL); if (val) free(val); elm_shutdown(); }
END_TEST START_TEST (elm_entry_atspi_text_char_count) { Evas_Object *win, *entry; int val; const char *mtxt = "<b>AĄ11Y</b> <title>Ł</> TEST"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); elm_object_text_set(entry, mtxt); eo_do(entry, val = elm_interface_atspi_text_character_count_get()); ck_assert(val == 12); elm_shutdown(); }
static void frame_content_show(struct MessageNewViewData *data) { struct Window *win = data->win; elm_layout_file_set(win->layout, MESSAGE_FILE, "content_edit"); data->bt1 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt1, D_("Close")); evas_object_smart_callback_add(data->bt1, "clicked", frame_content_close_clicked, data); window_swallow(win, "button_close", data->bt1); evas_object_show(data->bt1); data->bt2 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt2, D_("Continue")); evas_object_smart_callback_add(data->bt2, "clicked", frame_content_continue_clicked, data); window_swallow(win, "button_continue", data->bt2); evas_object_show(data->bt2); data->sc = elm_scroller_add(window_evas_object_get(win)); elm_scroller_policy_set(data->sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON); data->entry = elm_entry_add(window_evas_object_get(win)); evas_object_size_hint_weight_set(data->entry, 1.0, 1.0); evas_object_size_hint_align_set(data->entry, -1.0, -1.0); evas_object_smart_callback_add(data->entry, "changed", frame_content_content_changed, data); if (data->content != NULL) { elm_entry_entry_set(data->entry, data->content); } elm_scroller_content_set(data->sc, data->entry); evas_object_show(data->entry); window_swallow(win, "entry", data->sc); evas_object_show(data->sc); elm_object_focus(data->entry); }
END_TEST START_TEST (elm_entry_atspi_text_char_get) { Evas_Object *win, *entry; Eina_Unicode *expected; Eina_Unicode val; const char *txt = "ĄA11Y Ł TEST"; const char *mtxt = "<b>ĄA11Y</b> <title>Ł</> TEST"; elm_init(1, NULL); win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); entry = elm_entry_add(win); elm_object_text_set(entry, mtxt); expected = eina_unicode_utf8_to_unicode(txt, NULL); eo_do(entry, val = elm_interface_atspi_text_character_get(-1)); ck_assert(val == 0); eo_do(entry, val = elm_interface_atspi_text_character_get(0)); ck_assert(val == expected[0]); eo_do(entry, val = elm_interface_atspi_text_character_get(1)); ck_assert(val == expected[1]); eo_do(entry, val = elm_interface_atspi_text_character_get(2)); ck_assert(val == expected[2]); eo_do(entry, val = elm_interface_atspi_text_character_get(6)); ck_assert(val == expected[6]); eo_do(entry, val = elm_interface_atspi_text_character_get(26)); ck_assert(val == 0); free(expected); elm_shutdown(); }
/** * send * This function is used to create editfield * @param parent pointer to Evas object, as the parent * @param title string for title * @param str string for guide text * @param clicked_cb cb, when get single "clicked" * @param data_clicked @clicked_cb data * @param unfocused_cb cb, when get signle "unfocused" * @param data_unfocused @unfocused data * @return when success, return a pointer to evas object, or return NULL * @exception */ Evas_Object *widget_create_editfield(Evas_Object * parent, gchar * title, gchar * str, EO_SMART_CB clicked_cb, void *data_clicked, EO_SMART_CB unfocused_cb, void *data_unfocused) { Evas_Object *ret = NULL; int nErr = SUCCESS; Evas_Object *layout = elm_layout_add(parent); elm_layout_theme_set(layout, "layout", "editfield", "title"); Evas_Object *entry = elm_entry_add(parent); elm_object_part_content_set(layout, "elm.swallow.content", entry); ret = layout; CLK_RETVM_IF(!ret, NULL, "elm_editfield_add error!"); elm_object_part_text_set(layout, "elm.text", title); elm_object_part_text_set(layout, "elm.text", str); elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_scrollable_set(entry, EINA_TRUE); evas_object_size_hint_weight_set(ret, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(ret, EVAS_HINT_FILL, 0); //cb evas_object_smart_callback_add(entry, "changed", _entry_changed_cb, layout); evas_object_smart_callback_add(entry, "focused", _entry_focused_cb, layout); evas_object_smart_callback_add(entry, "unfocused", _entry_unfocused_cb, layout); elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", _eraser_clicked_cb, entry); End: //CLK_FUN_END(); return ret; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *conform, *btn, *bx, *en; win = elm_win_add(NULL, "conformant", ELM_WIN_BASIC); elm_win_title_set(win, "Conformant Example"); elm_win_autodel_set(win, EINA_TRUE); elm_win_conformant_set(win, EINA_TRUE); 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); conform = elm_conformant_add(win); elm_win_resize_object_add(win, conform); evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(conform); bx = elm_box_add(win); 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); btn = elm_button_add(win); elm_object_text_set(btn, "Test Conformant"); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); elm_box_pack_end(bx, btn); evas_object_show(btn); en = elm_entry_add(win); elm_entry_scrollable_set(en, EINA_TRUE); elm_object_text_set(en, "This is a multi-line entry at the bottom<br>" "This can contain more than 1 line of text and be " "scrolled around to allow for entering of lots of " "content. It is also to test to see that autoscroll " "moves to the right part of a larger multi-line " "text entry that is inside of a scroller than can be " "scrolled around, thus changing the expected position " "as well as cursor changes updating auto-scroll when " "it is enabled."); evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(en); elm_box_pack_end(bx, en); btn = elm_button_add(win); elm_object_text_set(btn, "Test Conformant"); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0); evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0); elm_box_pack_end(bx, btn); evas_object_show(btn); elm_object_content_set(conform, bx); evas_object_show(bx); evas_object_resize(win, 240, 480); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
static void _action_create_folder_cb(void *data, Enna_File *file) { Evas_Object *win; Evas_Object *bg; Evas_Object *fr; Evas_Object *en; Evas_Object *lb; Evas_Object *bx; Evas_Object *btn_bx; Evas_Object *btn_ok; Evas_Object *btn_cancel; Enna_Localfiles_Priv *priv = data; win = elm_win_add(enna->win, NULL, ELM_WIN_DIALOG_BASIC); elm_win_title_set(win, _("Create New Folder")); elm_win_autodel_set(win, EINA_TRUE); evas_object_data_set(win, "file", file); 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); evas_object_size_hint_min_set(bg, 400, 64); fr = elm_frame_add(win); elm_object_style_set(fr, "pad_medium"); evas_object_show(fr); elm_win_resize_object_add(win, fr); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bx, -1, -1); evas_object_show(bx); elm_frame_content_set(fr, bx); elm_box_padding_set(bx, 4, 4); lb = elm_label_add(win); elm_object_text_set(lb, _("Enter folder name")); evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(lb, 0.5, -1); evas_object_show(lb); elm_box_pack_end(bx, lb); en = elm_entry_add(win); elm_entry_single_line_set(en, EINA_TRUE); evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(en, -1, -1); elm_object_text_set(en, "New Folder"); elm_box_pack_end(bx, en); evas_object_show(en); evas_object_data_set(win, "entry", en); btn_bx = elm_box_add(win); elm_box_horizontal_set(btn_bx, EINA_TRUE); evas_object_size_hint_weight_set(btn_bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn_bx, EVAS_HINT_FILL, 0.5); evas_object_show(btn_bx); elm_box_padding_set(btn_bx, 8, 2); btn_ok = elm_button_add(win); elm_object_text_set(btn_ok, _("Create")); evas_object_show(btn_ok); evas_object_size_hint_weight_set(btn_ok, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn_ok, EVAS_HINT_FILL, 0.5); evas_object_smart_callback_add(btn_ok, "clicked", _dialog_create_folder_ok_clicked_cb, priv); elm_box_pack_end(btn_bx, btn_ok); btn_cancel = elm_button_add(win); elm_object_text_set(btn_cancel, _("Cancel")); evas_object_show(btn_cancel); evas_object_size_hint_weight_set(btn_cancel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn_cancel, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(btn_cancel, "clicked", _dialog_cancel_clicked_cb, priv); elm_box_pack_end(btn_bx, btn_cancel); elm_box_pack_end(bx, btn_bx); evas_object_show(win); priv->dialog = win; }
void create_compose(Data_Message *rep_to, const char *to, const char *text) { Evas_Object *bx, *bx2, *ph, *lb, *bt, *sc, *en; if (content) evas_object_del(content); reply_to = NULL; if (number) { free(number); number = NULL; } if (rep_to) { reply_to = rep_to; if (reply_to->from_to) number = strdup(reply_to->from_to); } if (to) { if (number) free(number); number = strdup(to); } bx = elm_box_add(window); evas_object_size_hint_weight_set(bx, 1.0, 1.0); evas_object_size_hint_align_set(bx, -1.0, -1.0); content = bx; bx2 = elm_box_add(window); elm_box_horizontal_set(bx2, 1); evas_object_size_hint_weight_set(bx2, 1.0, 0.0); evas_object_size_hint_align_set(bx2, -1.0, -1.0); ph = elm_photo_add(window); evas_object_smart_callback_add(ph, "clicked", on_to_select, NULL); evas_object_size_hint_weight_set(ph, 0.0, 1.0); evas_object_size_hint_align_set(ph, -1.0, -1.0); elm_box_pack_end(bx2, ph); evas_object_show(ph); write_ph = ph; lb = elm_label_add(window); elm_label_label_set(lb, "Select..."); evas_object_size_hint_weight_set(lb, 1.0, 1.0); evas_object_size_hint_align_set(lb, -1.0, 0.5); elm_box_pack_end(bx2, lb); evas_object_show(lb); write_lb = lb; lb = elm_label_add(window); elm_label_label_set(lb, "0"); evas_object_size_hint_weight_set(lb, 0.0, 1.0); evas_object_size_hint_align_set(lb, 0.5, 0.5); elm_box_pack_end(bx2, lb); evas_object_show(lb); write_stat = lb; if (number) { Data_Contact *ctc = data_contact_by_tel_find(number); if (ctc) { char *name, *file; elm_label_label_set(write_lb, number); name = data_contact_name_get(ctc); if (name) { elm_label_label_set(write_lb, name); free(name); } file = data_contact_photo_file_get(ctc); if (file) { elm_photo_file_set(write_ph, file); free(file); } } } elm_box_pack_end(bx, bx2); evas_object_show(bx2); sc = elm_scroller_add(window); evas_object_size_hint_weight_set(sc, 1.0, 1.0); evas_object_size_hint_align_set(sc, -1.0, -1.0); elm_box_pack_end(bx, sc); en = elm_entry_add(window); if (text) elm_entry_entry_set(en, text); else elm_entry_entry_set(en, ""); evas_object_size_hint_weight_set(en, 1.0, 1.0); evas_object_size_hint_align_set(en, -1.0, -1.0); elm_scroller_content_set(sc, en); evas_object_smart_callback_add(en, "changed", on_edit, NULL); evas_object_show(en); evas_object_show(sc); sms_entry = en; bt = elm_button_add(window); elm_button_label_set(bt, "Send"); evas_object_size_hint_weight_set(bt, 1.0, 0.0); evas_object_size_hint_align_set(bt, -1.0, -1.0); elm_box_pack_end(bx, bt); evas_object_smart_callback_add(bt, "clicked", on_send, NULL); evas_object_show(bt); elm_box_pack_end(box, bx); evas_object_show(bx); }
static void on_contact_select(void *data, Evas_Object *obj, void *event_info) { Data_Contact *ctc = data; if (!ctc) { Evas_Object *win, *bx, *bt, *sc, *en; win = window; inwin2 = elm_win_inwin_add(win); elm_object_style_set(inwin2, "minimal_vertical"); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, 1.0, 0.0); evas_object_size_hint_align_set(bx, -1.0, -1.0); sc = elm_scroller_add(win); elm_scroller_content_min_limit(sc, 0, 1); evas_object_size_hint_weight_set(sc, 1.0, 1.0); evas_object_size_hint_align_set(sc, -1.0, 0.5); elm_box_pack_end(bx, sc); en = elm_entry_add(win); elm_entry_single_line_set(en, 1); elm_entry_entry_set(en, "Enter number..."); evas_object_size_hint_weight_set(en, 1.0, 0.0); evas_object_size_hint_align_set(en, -1.0, 0.0); elm_entry_select_all(en); elm_scroller_content_set(sc, en); evas_object_show(en); evas_object_show(sc); number_entry = en; bt = elm_button_add(window); elm_button_label_set(bt, "OK"); evas_object_size_hint_weight_set(bt, 1.0, 0.0); evas_object_size_hint_align_set(bt, -1.0, -1.0); elm_box_pack_end(bx, bt); evas_object_smart_callback_add(bt, "clicked", on_number_ok, NULL); evas_object_show(bt); elm_win_inwin_content_set(inwin2, bx); evas_object_show(bx); elm_win_inwin_activate(inwin2); elm_object_focus(en); } else if (eina_list_count(ctc->tel.numbers) > 1) { Evas_Object *win, *bx, *bx2, *bt, *li, *fr, *ph, *lb; Eina_List *l; char *name, *file; win = window; inwin2 = elm_win_inwin_add(win); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, 1.0, 0.0); evas_object_size_hint_align_set(bx, -1.0, -1.0); fr = elm_frame_add(win); name = data_contact_name_get(ctc); if (name) { elm_label_label_set(write_lb, name); elm_frame_label_set(fr, name); free(name); } evas_object_size_hint_weight_set(fr, 1.0, 0.0); evas_object_size_hint_align_set(fr, -1.0, -1.0); elm_box_pack_end(bx, fr); evas_object_show(fr); bx2 = elm_box_add(win); elm_box_horizontal_set(bx2, 1); elm_frame_content_set(fr, bx2); evas_object_show(bx2); ph = elm_photo_add(win); file = data_contact_photo_file_get(ctc); if (file) { elm_photo_file_set(write_ph, file); elm_photo_file_set(ph, file); free(file); } evas_object_size_hint_weight_set(ph, 0.0, 0.0); evas_object_size_hint_align_set(ph, -1.0, -1.0); elm_box_pack_end(bx2, ph); evas_object_show(ph); lb = elm_label_add(win); elm_label_label_set(lb, "This contact has multiple<br>" "numbers. Select one."); evas_object_size_hint_weight_set(lb, 1.0, 0.0); evas_object_size_hint_align_set(lb, -1.0, -1.0); elm_box_pack_end(bx2, lb); evas_object_show(lb); li = elm_list_add(win); evas_object_size_hint_weight_set(li, 1.0, 1.0); evas_object_size_hint_align_set(li, -1.0, -1.0); elm_box_pack_end(bx, li); for (l = (Eina_List *)(ctc->tel.numbers); l; l = l->next) { Data_Contact_Tel *tel = l->data; // FIXME: // tel->flags can be 0 or more of: // DATA_CONTACT_TEL_HOME = (1 << 0), // DATA_CONTACT_TEL_MSG = (1 << 1), // DATA_CONTACT_TEL_WORK = (1 << 2), // DATA_CONTACT_TEL_PREF = (1 << 3), // DATA_CONTACT_TEL_VOICE = (1 << 4), // DATA_CONTACT_TEL_FAX = (1 << 5), // DATA_CONTACT_TEL_CELL = (1 << 6), // DATA_CONTACT_TEL_VIDEO = (1 << 7), // DATA_CONTACT_TEL_PAGER = (1 << 8), // DATA_CONTACT_TEL_BBS = (1 << 9), // DATA_CONTACT_TEL_MODEM = (1 << 10), // DATA_CONTACT_TEL_CAR = (1 << 11), // DATA_CONTACT_TEL_ISDN = (1 << 12), // DATA_CONTACT_TEL_PCS = (1 << 13) elm_list_item_append(li, tel->number, NULL, NULL, on_number_select, tel); } elm_list_go(li); evas_object_show(li); bt = elm_button_add(window); elm_button_label_set(bt, "OK"); evas_object_size_hint_weight_set(bt, 1.0, 0.0); evas_object_size_hint_align_set(bt, -1.0, -1.0); elm_box_pack_end(bx, bt); evas_object_smart_callback_add(bt, "clicked", on_number_list_ok, NULL); evas_object_show(bt); elm_win_inwin_content_set(inwin2, bx); evas_object_show(bx); elm_win_inwin_activate(inwin2); } else { Data_Contact_Tel *tel; char *name, *file; tel = ctc->tel.numbers->data; if (number) free(number); number = strdup(tel->number); elm_label_label_set(write_lb, number); name = data_contact_name_get(ctc); if (name) { elm_label_label_set(write_lb, name); free(name); } file = data_contact_photo_file_get(ctc); if (file) { elm_photo_file_set(write_ph, file); free(file); } } }
EOLIAN static void _jk_spinner_efl_canvas_group_group_add(Eo *obj, Jk_Spinner_Data *priv) { printf("jk spinner group group add \n"); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); JK_SPINNER_DATA_GET(obj, sd); efl_canvas_group_add(efl_super(obj, JK_SPINNER_CLASS)); elm_widget_sub_object_parent_add(obj); /* pd->rect = evas_object_rectangle_add(evas_object_evas_get(obj)); //evas_object_color_set(pd->rect, rand() % 255, rand() % 255, rand() % 255, 255/2); evas_object_show(pd->rect); evas_object_color_set(pd->rect, rand() % 255, rand() % 255, rand() % 255, 255/2); int r,g,b,a; evas_object_color_get(pd->rect, &r, &g, &b, &a); printf("color before : %d, %d, %d, %d \n", r, g, b, a); // evas_object_smart_member_add(pd->rect, obj); //elm_layout_content_set(obj, "elm.swallow.content", pd->rect); evas_object_color_get(pd->rect, &r, &g, &b, &a); printf("color after : %d, %d, %d, %d \n", r, g, b, a); evas_object_color_set(pd->rect, rand() % 255, rand() % 255, rand() % 255, 255/2); elm_widget_sub_object_add(obj, pd->rect); evas_object_color_get(pd->rect, &r, &g, &b, &a); printf("color after 222: %d, %d, %d, %d \n", r, g, b, a); */ elm_layout_file_set(obj, "edc/entry.edj", "main"); Evas_Object* en = elm_entry_add(obj); elm_entry_single_line_set(en, EINA_TRUE); elm_entry_editable_set(en, EINA_FALSE); //pd->entry = en; evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0); //evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5); //evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); //elm_object_text_set(en, "<align=center>hello</align>"); //elm_entry_text_style_user_push(en, "DEFAULT='align=center'"); //elm_entry_text_style_user_push(en, "DEFAULT='color=#0f0'"); elm_entry_text_style_user_push(en, user_style); evas_object_data_set(obj, "realentry", en); const char* cur_style = elm_entry_text_style_user_peek(en); /* if (cur_style) printf("Current style user: %s\n", cur_style); else printf("Style user stack is empty.\n"); */ const char* yep = "aaa"; /* elm_object_text_set(en, "aaa"); if (test == 1) yep = "xxx"; if (test == 2) yep = "yyy"; if (test == 3) yep = "zzz"; test++; */ elm_object_text_set(en, yep); evas_object_name_set(en, yep); //elm_entry_scrollable_set(en, EINA_TRUE); //elm_entry_scrollbar_policy_set(en, // ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); //evas_object_smart_member_add(rect, en); elm_layout_content_set(obj, "content", en); elm_widget_sub_object_add(obj, en); evas_object_show(en); elm_widget_can_focus_set(obj, EINA_TRUE); elm_layout_sizing_eval(obj); evas_object_data_set(en, "smart", obj); /* evas_object_smart_callback_add(en, "activated", _entry_activated, obj); evas_object_smart_callback_add(en, "unfocused", _entry_unfocused, obj); evas_object_smart_callback_add(en, "changed,user", _entry_changed, obj); //evas_object_smart_callback_add(en, "focused", _select_all, pd); //evas_object_smart_callback_add(en, "selection,changed", _print_signal, "selection changed"); evas_object_smart_callback_add(en, "selection,cleared", _entry_cleared, pd); //evas_object_smart_callback_add(en, "selection,start", _print_signal, "selection start"); //evas_object_smart_callback_add(en, "clicked", _print_signal, "clicked"); //evas_object_smart_callback_add(en, "cursor,changed", _print_signal, "cursor,changed"); //evas_object_smart_callback_add(en, "cursor,changed,manual", _print_signal, "cursor,changed,manual"); elm_layout_signal_callback_add(obj, "mouse,down,1", "bg",_ondown, pd); elm_layout_signal_callback_add(obj, "mouse,move", "bg", _onmove, obj); elm_layout_signal_callback_add(obj, "mouse,up,1", "bg", _onup, obj); elm_layout_signal_callback_add(obj, "mouse,clicked,1", "bg", _onclicked, pd); elm_layout_signal_callback_add(obj, "drag", "*", _drag_cb, obj); elm_layout_signal_callback_add(obj, "drag,start", "*", _drag_start_cb, obj); elm_layout_signal_callback_add(obj, "drag,stop", "*", _drag_stop_cb, obj); elm_layout_signal_callback_add(obj, "drag,step", "*", _drag_stop_cb, obj); elm_layout_signal_callback_add(obj, "drag,page", "*", _drag_stop_cb, obj); */ }
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; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *vbox, *hbox, *ic, *ck, *fs_bt, *en, *lb, *sep; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("fileselector-button", "File Selector Button Example"); elm_win_autodel_set(win, EINA_TRUE); vbox = elm_box_add(win); evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, vbox); evas_object_show(vbox); ic = elm_icon_add(win); elm_icon_standard_set(ic, "file"); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); /* file selector button */ fs_bt = elm_fileselector_button_add(win); elm_fileselector_button_path_set(fs_bt, "/tmp"); elm_object_text_set(fs_bt, "Select a file"); elm_object_part_content_set(fs_bt, "icon", ic); elm_box_pack_end(vbox, fs_bt); evas_object_show(fs_bt); evas_object_show(ic); /* attribute setting knobs */ sep = elm_separator_add(win); elm_separator_horizontal_set(sep, EINA_TRUE); elm_box_pack_end(vbox, sep); evas_object_show(sep); hbox = elm_box_add(win); elm_box_horizontal_set(hbox, EINA_TRUE); elm_box_pack_end(vbox, hbox); evas_object_show(hbox); ck = elm_check_add(win); elm_object_text_set(ck, "editable selection"); elm_check_state_set(ck, elm_fileselector_button_is_save_get(fs_bt)); evas_object_smart_callback_add(ck, "changed", _current_sel_toggle, fs_bt); elm_box_pack_end(hbox, ck); evas_object_show(ck); ck = elm_check_add(win); elm_object_text_set(ck, "\"inwin\" mode"); elm_check_state_set(ck, elm_fileselector_button_inwin_mode_get(fs_bt)); evas_object_smart_callback_add(ck, "changed", _inwin_mode_toggle, fs_bt); elm_box_pack_end(hbox, ck); evas_object_show(ck); ck = elm_check_add(win); elm_object_text_set(ck, "folders only"); elm_check_state_set(ck, elm_fileselector_button_folder_only_get(fs_bt)); evas_object_smart_callback_add(ck, "changed", _folder_only_toggle, fs_bt); elm_box_pack_end(hbox, ck); evas_object_show(ck); ck = elm_check_add(win); elm_object_text_set(ck, "expandable"); elm_check_state_set(ck, elm_fileselector_button_expandable_get(fs_bt)); evas_object_smart_callback_add(ck, "changed", _expandable_toggle, fs_bt); elm_box_pack_end(hbox, ck); evas_object_show(ck); lb = elm_label_add(win); elm_object_text_set(lb, "Last selection:"); elm_box_pack_end(vbox, lb); evas_object_show(lb); en = elm_entry_add(win); elm_entry_line_wrap_set(en, EINA_FALSE); elm_entry_editable_set(en, EINA_FALSE); evas_object_smart_callback_add(fs_bt, "file,chosen", _file_chosen, en); elm_box_pack_end(vbox, en); evas_object_show(en); evas_object_resize(win, 400, 400); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
static void _win_search_trigger_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Key_Down *ev = event_info; App_Data *ad = data; Evas_Object *box, *box2, *entry, *btn, *ic; if (strcmp(ev->keyname, "f") || !evas_key_modifier_is_set(ev->modifiers, "Control")) return; if (ad->search_box || !ad->current_tab) return; box = elm_box_add(ad->win); elm_box_horizontal_set(box, EINA_TRUE); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_after(ad->main_box, box, ad->url); evas_object_show(box); evas_object_event_callback_add(box, EVAS_CALLBACK_DEL, _search_box_del_cb, ad); entry = elm_entry_add(ad->win); elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_scrollable_set(entry, EINA_TRUE); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, entry); evas_object_show(entry); evas_object_smart_callback_add(entry, "changed", _search_entry_changed_cb, ad); evas_object_smart_callback_add(entry, "activated", _search_entry_activate_cb, ad); box2 = elm_box_add(ad->win); elm_box_horizontal_set(box2, EINA_TRUE); elm_object_part_content_set(entry, "end", box2); btn = elm_button_add(ad->win); elm_box_pack_end(box2, btn); evas_object_show(btn); ic = elm_icon_add(ad->win); elm_icon_standard_set(ic, "arrow_up"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _search_prev_cb, ad); btn = elm_button_add(ad->win); elm_box_pack_end(box2, btn); evas_object_show(btn); ic = elm_icon_add(ad->win); elm_icon_standard_set(ic, "arrow_down"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _search_next_cb, ad); btn = elm_button_add(ad->win); elm_box_pack_end(box, btn); evas_object_show(btn); ic = elm_icon_add(ad->win); elm_icon_standard_set(ic, "close"); elm_object_part_content_set(btn, "icon", ic); evas_object_smart_callback_add(btn, "clicked", _search_close_cb, ad); ad->search_box = box; ad->search_entry = entry; elm_object_focus_set(entry, EINA_TRUE); }