The source code moved from the SPIN with license changed to Flora 1.1
[apps/native/home/homescreen-efl.git] / inc / popup.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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
7  *
8  * http://floralicense.org/license/
9  *
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.
15  */
16
17 #ifndef POPUP_H_
18 #define POPUP_H_
19
20 #include <Evas.h>
21
22 #include "app_icon.h"
23
24 typedef enum {
25         ORDER_MANUALLY = 0,
26         ORDER_ALPHABETICAL = 1
27 } order_mode_t;
28
29 typedef enum {
30         POPUP_TWO_BUTTONS,
31         POPUP_INFO,
32 } popup_type_t;
33
34 typedef struct {
35         popup_type_t type;
36         char *popup_title_text;
37         char *popup_content_text;
38         char *popup_confirm_text;
39         char *popup_cancel_text;
40         Elm_Popup_Orient orientation;
41         double visible_time;
42 } popup_data_t;
43
44 typedef void (*popup_confirm_cb)(void *data);
45 typedef void (*popup_cancel_cb)(void *data);
46
47 /**
48  * @brief Allocates a structure for initialze popup widet
49  * @return Pointer to popup data. It must be freed manually.
50  */
51 popup_data_t *popup_create_data(void);
52
53 /**
54  * @brief Frees p_data structure memory and its members
55  * @return
56  */
57 void popup_data_free(popup_data_t *p_data);
58
59 /**
60  * @brief Function shows popup window on the screen
61  * @param data popup_data_t struct which is used for initialize popup with
62  * its content.
63  *popup_confirm_cb - function called when confirm button will be clicked.
64  * popup_cancel_cb - function called when cancel button will be clicked.
65  * cb_data - data used in callback functions.
66  */
67 void popup_show(popup_data_t *data, popup_confirm_cb confirm_cb,
68                                 popup_cancel_cb cancel_cb, void *cb_data);
69
70 /**
71  * @brief Hide popup and remove all data
72  * @returns EINA_TRUE if popup is visible otherwise EINA_FALSE
73  */
74 Eina_Bool popup_destroy(void);
75
76 #endif /* POPUP_H_ */