2 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "setting_view_toast.h"
22 Toast_Data* _create_toast( void * data, char * msg )
24 Toast_Data * toast = (Toast_Data *) calloc(sizeof(Toast_Data), 1);
27 toast->str = strdup(msg);
28 toast->toast_popup = NULL;
33 void _destroy_toast( Toast_Data* toast )
39 if(toast->toast_popup) {
40 evas_object_del(toast->toast_popup);
41 toast->toast_popup = NULL;
47 void _dismiss_toast(void *data, Evas_Object *obj, void *event_info)
49 Toast_Data* toast =(Toast_Data*)data;
50 _destroy_toast(toast);
53 void _show_toast( void * data, Toast_Data* toast )
56 if( ad == NULL || toast == NULL ) {
60 if( toast->is_show ) {
64 toast->toast_popup = elm_popup_add(ad->nf);
65 elm_object_style_set(toast->toast_popup, "toast");
66 elm_popup_orient_set(toast->toast_popup, ELM_POPUP_ORIENT_BOTTOM);
67 evas_object_size_hint_weight_set(toast->toast_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
68 ea_object_event_callback_add(toast->toast_popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
69 elm_object_part_text_set(toast->toast_popup,"elm.text", toast->str);
70 elm_popup_timeout_set(toast->toast_popup, 2.0);
72 evas_object_smart_callback_add(toast->toast_popup, "block,clicked", _dismiss_toast, toast);
73 evas_object_smart_callback_add(toast->toast_popup, "timeout", _dismiss_toast, toast);
75 evas_object_show(toast->toast_popup);