Evas_Object *common_utils_show_info_popup(Evas_Object *parent, popup_btn_info_t *popup_data) { __COMMON_FUNC_ENTER__; Evas_Object *popup = elm_popup_add(parent); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); if (popup_data->title_txt) elm_object_part_text_set(popup, "title,text", popup_data->title_txt); if (popup_data->info_txt) elm_object_text_set(popup, popup_data->info_txt); if (popup_data->btn1_txt) { Evas_Object *btn_1 = elm_button_add(popup); elm_object_text_set(btn_1, popup_data->btn1_txt); elm_object_part_content_set(popup, "button1", btn_1); if (popup_data->btn1_cb) { evas_object_smart_callback_add(btn_1, "clicked", popup_data->btn1_cb, popup_data->btn1_data); } else { // set the default callback evas_object_smart_callback_add(btn_1, "clicked", (Evas_Smart_Cb)evas_object_del, popup); } } if (popup_data->btn2_txt) { Evas_Object *btn_2 = elm_button_add(popup); elm_object_text_set(btn_2, popup_data->btn2_txt); elm_object_part_content_set(popup, "button2", btn_2); evas_object_smart_callback_add(btn_2, "clicked", popup_data->btn2_cb, NULL); evas_object_show(popup); if (popup_data->btn2_cb) { evas_object_smart_callback_add(btn_2, "clicked", popup_data->btn2_cb, popup_data->btn2_data); } else { // set the default callback evas_object_smart_callback_add(btn_2, "clicked", (Evas_Smart_Cb)evas_object_del, popup); } } evas_object_show(popup); return popup; }
static int __app_reset(bundle *b, void *data) { struct appdata *ad = data; Evas_Object *popup; const char *val; int ret = 0; ad->b = bundle_dup(b); bundle_iterate(b, __prt_recvd_bundle, NULL); if (syspopup_has_popup(b)) { syspopup_reset(b); } else { popup = elm_popup_add(ad->win); if (popup != NULL) { ret = syspopup_create(b, &handler, ad->win, ad); evas_object_show(ad->win); if (ret == 0) { val = bundle_get_val(b, "_INTERNAL_SYSPOPUP_NAME_"); val = bundle_get_val(b, "_SYSPOPUP_TITLE_"); if (val) { snprintf(ad->title, TITLE_BUF_LEN, "%s", val); } else { snprintf(ad->title, TITLE_BUF_LEN, "%s", "Unknown Title"); } val = bundle_get_val(b, "_SYSPOPUP_CONTENT_"); if (val) { snprintf(ad->content, CONTENT_BUF_LEN, "%s", val); } else { snprintf(ad->content, CONTENT_BUF_LEN, "%s", "Unknown Content"); } elm_object_style_set(popup, "char_wrap_style"); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, NULL); elm_object_part_text_set(popup, "title,text", ad->title); elm_object_text_set(popup, ad->content); evas_object_smart_callback_add(popup, "response", __response_cb, NULL); evas_object_show(popup); } } } return 0; }
/** * send * This function is used to create popup * @param parent[in] pointer to evas object, as the parent * @param content_str[in] string for description text. * @param title_str[in] string for label * @param timeout[double] double for popup time * @param response_cb[in] cb to get single "response" * @param data[in] @response_cb data * @return when success, return a pointer to evas object, or return NULL * @exception */ Evas_Object *widget_create_popup(Evas_Object * parent, char *content_str, char *title_str, double timeout, EO_SMART_CB response_cb, void *data) { Evas_Object *popup = elm_popup_add(parent); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); if (content_str) { gchar r_str_text[200] = { 0 }; snprintf(r_str_text, sizeof(r_str_text), "<font_size=32><align=center>%s</align></font_size>", content_str); elm_object_text_set(popup, r_str_text); } if (title_str) { elm_object_text_set(popup, title_str); } if (timeout > 0) { elm_popup_timeout_set(popup, timeout); } if (response_cb) { evas_object_smart_callback_add(popup, "response", response_cb, data); } else { evas_object_smart_callback_add(popup, "response", _widget_def_popup_response_cb, data); } evas_object_show(popup); return popup; }
Eina_Bool Browser_Settings_Website_Setting::_show_delete_all_details_list_confirm_popup(void) { BROWSER_LOGD("[%s]", __func__); if (m_delete_all_details_list_confirm_popup) evas_object_del(m_delete_all_details_list_confirm_popup); m_delete_all_details_list_confirm_popup = elm_popup_add(m_details_genlist); if (!m_delete_all_details_list_confirm_popup) { BROWSER_LOGE("elm_popup_add failed"); return EINA_FALSE; } evas_object_size_hint_weight_set(m_delete_all_details_list_confirm_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(m_delete_all_details_list_confirm_popup, BR_STRING_DELETE_ALL_WEBSITE_DATA_AND_LOCATION_PERMISSIONS); Evas_Object *ok_button = elm_button_add(m_delete_all_details_list_confirm_popup); if (!ok_button) { BROWSER_LOGE("elm_button_add failed"); return EINA_FALSE; } elm_object_text_set(ok_button, BR_STRING_YES); elm_object_part_content_set(m_delete_all_details_list_confirm_popup, "button1", ok_button); evas_object_smart_callback_add(ok_button, "clicked", __delete_all_details_list_confirm_response_cb, this); Evas_Object *cancel_button = elm_button_add(m_delete_all_details_list_confirm_popup); elm_object_text_set(cancel_button, BR_STRING_NO); elm_object_part_content_set(m_delete_all_details_list_confirm_popup, "button2", cancel_button); evas_object_smart_callback_add(cancel_button, "clicked", __cancel_delete_all_details_list_confirm_response_cb, this); evas_object_show(m_delete_all_details_list_confirm_popup); return EINA_TRUE; }
void show_graphic_popup(appdata_s *ad, char *text, int timeout){ Evas_Object *popup, *layout, *progressbar; ad->popup = elm_popup_add(ad->win); elm_object_style_set(ad->popup, "circle"); layout = elm_layout_add(ad->popup); elm_layout_file_set(layout, ELM_DEMO_EDJ, "popup_progressbar"); elm_object_content_set(ad->popup, layout); elm_object_part_text_set(layout,"elm.text", text); evas_object_show(layout); progressbar = elm_progressbar_add(layout); elm_object_style_set(progressbar, "process/popup/small"); evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_progressbar_pulse(progressbar, EINA_TRUE); elm_object_part_content_set(layout, "elm.swallow.content", progressbar); evas_object_show(progressbar); evas_object_show(ad->popup); if(timeout>0){ elm_popup_timeout_set(ad->popup, timeout); evas_object_smart_callback_add(ad->popup, "timeout", destroy_popup, ad); }else{ evas_object_smart_callback_del(ad->popup, "timeout", destroy_popup); } }
static void startup(void) { tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); elm_init(0, NULL); main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); evas_object_show(main_win); popup = elm_popup_add(main_win); evas_object_show(popup); }
Evas_Object *common_utils_show_info_timeout_popup(Evas_Object *win, const char* info_text, const double timeout) { Evas_Object *popup = elm_popup_add(win); elm_object_text_set(popup, info_text); elm_popup_timeout_set(popup, timeout); evas_object_smart_callback_add(popup, "timeout", (Evas_Smart_Cb)evas_object_del, popup); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER); evas_object_show(popup); return popup; }
void Browser_Common_View::show_msg_popup(const char *msg, int timeout) { BROWSER_LOGD("[%s]", __func__); if (m_popup) { evas_object_del(m_popup); m_popup = NULL; } m_popup = elm_popup_add(m_navi_bar); evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(m_popup, msg); elm_popup_timeout_set(m_popup, timeout); evas_object_show(m_popup); }
Eina_Bool Browser_Common_View::_show_share_popup(const char *url) { BROWSER_LOGE("url=[%s]", url); if (!url || strlen(url) == 0) { BROWSER_LOGE("url is empty"); return EINA_FALSE; } m_share_url = std::string(url); m_sns_path_list.clear(); m_sns_name_list.clear(); m_sns_icon_list.clear(); m_share_popup = elm_popup_add(m_navi_bar); if (!m_share_popup) { BROWSER_LOGE("elm_popup_add failed"); return EINA_FALSE; } elm_object_style_set(m_share_popup, "menustyle"); elm_object_part_text_set(m_share_popup, "title,text", BR_STRING_SHARE); evas_object_size_hint_weight_set(m_share_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); m_share_list = elm_list_add(m_share_popup); if (!m_share_list) { BROWSER_LOGE("elm_list_add failed"); return EINA_FALSE; } evas_object_size_hint_weight_set(m_share_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(m_share_list, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_list_item_append(m_share_list, BR_STRING_MESSAGES, NULL, NULL, __send_via_message_cb, this); elm_list_item_append(m_share_list, BR_STRING_EMAIL, NULL, NULL, __send_via_email_cb, this); evas_object_show(m_share_list); Evas_Object *cancel_button = elm_button_add(m_share_popup); elm_object_text_set(cancel_button, BR_STRING_CANCEL); elm_object_part_content_set(m_share_popup, "button1", cancel_button); elm_object_style_set(cancel_button, "popup_button/default"); evas_object_smart_callback_add(cancel_button, "clicked", __popup_response_cb, this); elm_object_content_set(m_share_popup, m_share_list); evas_object_show(m_share_popup); return EINA_TRUE; }
static void create_datetime_popup(datetimedata_s *dd) { Evas_Object *set_btn, *cancel_btn; dd->popup = elm_popup_add(dd->nf); eext_object_event_callback_add(dd->popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL); evas_object_size_hint_weight_set(dd->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_popup_align_set(dd->popup, ELM_NOTIFY_ALIGN_FILL, 0.5); cancel_btn = elm_button_add(dd->popup); elm_object_text_set(cancel_btn, "Cancel"); elm_object_part_content_set(dd->popup, "button1", cancel_btn); evas_object_smart_callback_add(cancel_btn, "clicked", popup_cancel_btn_clicked_cb, dd); set_btn = elm_button_add(dd->popup); elm_object_text_set(set_btn, "Set"); elm_object_part_content_set(dd->popup, "button2", set_btn); evas_object_smart_callback_add(set_btn, "clicked", popup_set_btn_clicked_cb, dd); }
static void _main_view_show_warning_popup(Evas_Object *navi, const char *caption, const char *text, const char *button_text, void *data) { RETM_IF(!data, "data is null"); DBG(" <<< called"); main_view *main_view_data = data; Evas_Object *popup = elm_popup_add(navi); RETM_IF(!popup, "popup is not created"); elm_object_part_text_set(popup, "title,text", caption); elm_object_text_set(popup, text); evas_object_show(popup); Evas_Object *button = elm_button_add(popup); RETM_IF(!button, "button is not created"); elm_object_style_set(button, POPUP_BUTTON_STYLE); elm_object_text_set(button, button_text); elm_object_part_content_set(popup, POPUP_BUTTON_PART, button); evas_object_smart_callback_add(button, "clicked", _main_view_popup_close_cb, main_view_data); eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _main_view_popup_close_cb, main_view_data); main_view_data->popup = popup; }
/* Basic popup widget */ int usbotg_unmount_create_and_show_basic_popup(struct appdata *ad) { Evas_Object *btn1; Evas_Object *btn2; char buf[PATH_MAX] = {0, }; /* Initialization */ int ret_val = 0; snprintf(buf, PATH_MAX, "Unmount %s?", dev_name); ad->device_name = malloc(strlen(dev_name)+1); strncpy(ad->device_name, dev_name, strlen(dev_name)); /* Add notify */ /* No need to give main window, it will create internally */ ad->popup = elm_popup_add(ad->win_main); evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(ad->popup, buf); elm_object_part_text_set(ad->popup, "title,text", _("IDS_COM_BODY_SYSTEM_INFO_ABB")); btn1 = elm_button_add(ad->popup); elm_object_text_set(btn1, "OK"); elm_object_part_content_set(ad->popup, "button1", btn1); evas_object_smart_callback_add(btn1, "clicked", ok_clicked_cb, ad); btn2 = elm_button_add(ad->popup); elm_object_text_set(btn2, "Cancel"); elm_object_part_content_set(ad->popup, "button2", btn2); evas_object_smart_callback_add(btn2, "clicked", bg_clicked_cb, ad); Ecore_X_Window xwin; xwin = elm_win_xwindow_get(ad->popup); ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); evas_object_show(ad->popup); return 0; }
int create_and_show_basic_popup_min(struct appdata *ad) { Evas_Object *btn1; Evas_Object *btn2; ad->popup_poweroff = elm_popup_add(ad->win_main); if (ad->popup_poweroff == NULL) { system_print("\n System-popup : Add popup failed \n"); return -1; } evas_object_size_hint_weight_set(ad->popup_poweroff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(ad->popup_poweroff, _("IDS_ST_BODY_POWER_OFF")); elm_object_part_text_set(ad->popup_poweroff, "title,text", _("IDS_COM_BODY_SYSTEM_INFO_ABB")); btn1 = elm_button_add(ad->popup_poweroff); elm_object_text_set(btn1, _("IDS_COM_SK_OK")); elm_object_part_content_set(ad->popup_poweroff, "button1", btn1); elm_object_style_set (btn1,"popup_button/default"); evas_object_smart_callback_add(btn1, "clicked", poweroff_response_yes_cb_min, ad); btn2 = elm_button_add(ad->popup_poweroff); elm_object_text_set(btn2, _("IDS_COM_SK_CANCEL")); elm_object_part_content_set(ad->popup_poweroff, "button2", btn2); elm_object_style_set (btn2,"popup_button/default"); evas_object_smart_callback_add(btn2, "clicked", poweroff_response_no_cb_min, ad); Ecore_X_Window xwin; xwin = elm_win_xwindow_get(ad->popup_poweroff); ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION); utilx_grab_key(ecore_x_display_get(), xwin, KEY_SELECT, SHARED_GRAB); ecore_event_handler_add(ECORE_EVENT_KEY_UP, poweroff_response_no_cb_min, NULL); evas_object_show(ad->popup_poweroff); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *popup, *btn1, *btn2, *btn3, *icon1; char buf[256]; elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); elm_win_title_set(win, "Popup"); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 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); popup = elm_popup_add(win); // Setting popup content-text elm_object_text_set(popup, "This is the Content-Text for popup. The wrap" "for the content-text is character wrapping"); // Setting the wrapping type to character wrapping elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR); // Seting popup title-text elm_object_part_text_set(popup, "title,text", "Title"); icon1 = elm_icon_add(popup); snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(icon1, buf, NULL); //Setting popup title-icon elm_object_part_content_set(popup, "title,icon", icon1); // Creating the first action button btn1 = elm_button_add(popup); elm_object_text_set(btn1, "OK"); // Setting the fist action button elm_object_part_content_set(popup, "button1", btn1); evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup); // Creating the second action button btn2 = elm_button_add(popup); elm_object_text_set(btn2, "Cancel"); // Setting the second action button elm_object_part_content_set(popup, "button2", btn2); evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup); btn3 = elm_button_add(popup); elm_object_text_set(btn3, "Close"); // Setting this action button elm_object_part_content_set(popup, "button3", btn3); // Setting the orientation of popup to Top elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP); // Display the popup object evas_object_show(popup); evas_object_resize(win, 480, 800); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }