4 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 int load_normal_popup(const struct popup_ops *ops)
31 char content[BUF_MAX];
32 struct object_ops *obj;
38 ret = get_object_by_ops(ops, &obj);
40 _E("Failed to get object (%d)", ret);
48 evas_object_show(win);
50 popup = elm_popup_add(win);
54 elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
55 evas_object_size_hint_weight_set(popup,
56 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 elm_object_part_text_set(popup, "title,text", _(ops->title));
62 snprintf(content, sizeof(content), "%s", _(ops->content));
63 else if (ops->get_content) {
64 ret = ops->get_content(ops, content, sizeof(content));
66 _E("Failed to get popup content");
72 text = elm_entry_utf8_to_markup(content);
75 elm_object_text_set(popup, text);
80 lbtn = elm_button_add(popup);
82 elm_object_text_set(lbtn, _(ops->left_text));
83 elm_object_style_set(lbtn, "bottom");
84 elm_object_part_content_set(popup, "button1", lbtn);
85 evas_object_smart_callback_add(lbtn, "clicked", left_clicked, ops);
89 if (ops->right_text) {
91 rbtn = elm_button_add(popup);
93 elm_object_text_set(rbtn, _(ops->right_text));
94 elm_object_style_set(rbtn, "bottom");
95 elm_object_part_content_set(popup, "button2", rbtn);
96 evas_object_smart_callback_add(rbtn, "clicked", right_clicked, ops);
100 evas_object_show(popup);