common : fix a potential bug by profile that is ivi or other one
[platform/core/system/system-popup.git] / src / common / popup-common.h
1 /*
2  *  system-popup
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20
21 #ifndef __POPUP_COMMON_H__
22 #define __POPUP_COMMON_H__
23
24 #include "popup-common-internal.h"
25 #include "macro.h"
26
27 struct popup_ops {
28         /* Name */
29         char *name;
30
31         /* Contents */
32         char *title;
33         char *content;
34         int  (*get_content)(const struct popup_ops *ops,
35                         char *content, unsigned int len);
36         /* Left button */
37         char *left_text;
38         void (*left)(const struct popup_ops *ops);
39         /* Right button */
40         char *right_text;
41         void (*right)(const struct popup_ops *ops);
42
43         /* Feedback */
44         int pattern;
45
46         /* Show popup */
47         bool (*skip)(bundle *b, const struct popup_ops *ops);
48         int  (*change) (bundle *b, const struct popup_ops *ops);
49         int  (*pre) (bundle *b, const struct popup_ops *ops);
50         int  (*show) (bundle *b, const struct popup_ops *ops);
51         int  (*post) (bundle *b, const struct popup_ops *ops);
52         void (*terminate)(const struct popup_ops *ops);
53
54         /* Term scenarios */
55         bool (*term_pause)(const struct popup_ops *ops);
56         bool (*term_home)(const struct popup_ops *ops);
57 };
58
59 typedef struct appdata {
60         Evas_Object *win;
61         Evas_Object *conform;
62         Evas_Object *layout;
63 #ifdef PROFILE_WEARABLE
64         Evas_Object *nf;
65         Evas_Object *datetime;
66         Evas_Object *popup;
67         Evas_Object *button;
68         Eext_Circle_Surface *circle_surface;
69         struct tm saved_time;
70 #else
71         Evas_Object *fb;
72 #endif
73 } appdata_s;
74
75 /* Common */
76 void terminate_if_no_popup(void);
77
78 /* Popup */
79 void register_popup(const struct popup_ops *ops);
80 void update_popup(const struct popup_ops *old_ops, const struct popup_ops *new_ops);
81 void unload_simple_popup(const struct popup_ops *ops);
82 int load_simple_popup(bundle *b, const struct popup_ops *ops);
83 bool get_check_state(const struct popup_ops *ops);
84
85 /* dbus */
86 int set_dbus_connection(void);
87 void unset_dbus_connection(void);
88 E_DBus_Connection *get_dbus_connection(void);
89 int broadcast_dbus_signal(
90                 const char *path,
91                 const char *interface,
92                 const char *name,
93                 const char *sig,
94                 char *param[]);
95 int popup_dbus_method_sync(
96                 const char *dest,
97                 const char *path,
98                 const char *interface,
99                 const char *method,
100                 const char *sig,
101                 char *param[]);
102 int register_dbus_signal_handler(
103                 E_DBus_Signal_Handler **handler,
104                 const char *path,
105                 const char *iface,
106                 const char *name,
107                 void (*signal_cb)(void *data, DBusMessage *msg),
108                 void *data);
109 void unregister_dbus_signal_handler(E_DBus_Signal_Handler *handler);
110
111 /* feedback */
112 void play_feedback(int type, int pattern);
113 void init_multi_feedback(void);
114 void play_multi_feedback(int pattern);
115 void stop_multi_feedback(void);
116 void notify_feedback(long pattern); /* using thread */
117
118 void change_display_state(void); /* using thread */
119 void event_back_key_up(void *data, Evas_Object *obj, void *event_info);
120 #endif /* __POPUP_COMMON_H__ */