summaryrefslogtreecommitdiff
path: root/src/widget/mf-ug-popup.c
blob: cceeb69661ad0fa585963d0b8c6a9ac53b48173f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the "License");
 *
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.tizenopensource.org/license
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */




#include "mf-ug-util.h"
#include "mf-ug-winset.h"
#include "mf-ug-resource.h"


/******************************
** Prototype    : mfPopupCreate
** Description  :
** Input        : void *data
**                ePopMode popupMode
**                char *title
**                char *context
**                char *first_btn_text
**                char *second_btn_text
**                char *third_btn_text
**                Evas_Smart_Cb func
**                void* param
** Output       : None
** Return Value :
** Calls        :
** Called By    :
**
**  History        :
**  1.Date         : 2010/12/10
**    Author       : Samsung
**    Modification : Created function
**
******************************/
void mf_ug_popup_create(void *data, mf_ug_popup_mode popupMode, char *title, char *context, char *first_btn_text, char *second_btn_text,
			char *third_btn_text, Evas_Smart_Cb func, void *param)
{
	Evas_Object *popup;
	ugData *ugd = (ugData *)data;
	ug_mf_retm_if(ugd == NULL, "ugd is NULL");
	Evas_Object *btn1 = NULL;
	Evas_Object *btn2 = NULL;

	popup = elm_popup_add(ugd->ug_MainWindow.ug_pMainLayout);
	ugd->ug_MainWindow.ug_pNormalPopup = popup;
	evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	if (title) {
		elm_object_part_text_set(popup, "elm.title", title);
	}
	if (context && popupMode != UG_POPMODE_PROGRESSBAR) {
		elm_object_text_set(popup, context);
	}
	switch (popupMode) {
	case UG_POPMODE_TEXT:
	case UG_POPMODE_TITLE_TEXT:
		elm_popup_timeout_set(popup, 3);
		if (func) {
			evas_object_smart_callback_add(popup, "response", (Evas_Smart_Cb) func, param);
		}
		break;
	case UG_POPMODE_TEXT_TWO_BTN:
	case UG_POPMODE_TITLE_TEXT_TWO_BTN:
		btn1 = __ug_mf_popup_button_create(popup, first_btn_text);
		btn2 = __ug_mf_popup_button_create(popup, second_btn_text);

		evas_object_smart_callback_add(btn1, "clicked", func, param);
		evas_object_smart_callback_add(btn2, "clicked", func, param);
		elm_object_part_content_set(popup, "button1", btn1);
		elm_object_part_content_set(popup, "button2", btn2);
		break;
	case UG_POPMODE_TEXT_BTN:
	case UG_POPMODE_TITLE_TEXT_BTN:
		btn1 = __ug_mf_popup_button_create(popup, MF_UG_LABEL_OK);
		evas_object_smart_callback_add(btn1, "clicked", func, param);
		elm_object_part_content_set(popup, "button1", btn1);
		break;
	default:
		return;
	}
	evas_object_show(popup);
}