d43a912c74334648846b54780f4cc682b6041a3a
[platform/core/appfw/data-provider-slave.git] / include / so_handler.h
1 /*
2  * Copyright 2013  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 typedef int (*create_t)(const char *filename, const char *content, const char *cluster, const char *category);
18 typedef int (*destroy_t)(const char *filename);
19 typedef int (*is_updated_t)(const char *filename);
20 typedef int (*need_to_destroy_t)(const char *filename);
21 typedef int (*update_content_t)(const char *filename);
22 typedef int (*clicked_t)(const char *filename, const char *event, double timestamp, double x, double y);
23 typedef int (*text_signal_t)(const char *filename, const char *signal_name, const char *source, widget_event_info_s event_info);
24 typedef int (*resize_t)(const char *filename, int type);
25 typedef int (*create_needed_t)(const char *cluster, const char *category);
26 typedef int (*change_group_t)(const char *filename, const char *cluster, const char *category);
27 typedef int (*get_output_info_t)(const char *filename, int *w, int *h, double *priority, char **content, char **title);
28 typedef int (*initialize_t)(const char *pkgname);
29 typedef int (*finalize_t)(void);
30 typedef char *(*pinup_t)(const char *filename, int pinup);
31 typedef int (*is_pinned_up_t)(const char *filename);
32 typedef int (*system_event_t)(const char *filename, int type);
33 typedef int (*get_alt_info_t)(const char *filename, char **icon, char **name);
34 typedef int (*set_content_info_t)(const char *filename, const char *content_info);
35
36 typedef int (*adaptor_create_t)(const char *pkgname, const char *filename, const char *content, const char *cluster, const char *category);
37 typedef int (*adaptor_destroy_t)(const char *pkgname, const char *filename);
38 typedef int (*adaptor_is_updated_t)(const char *pkgname, const char *filename);
39 typedef int (*adaptor_need_to_destroy_t)(const char *pkgname, const char *filename);
40 typedef int (*adaptor_update_content_t)(const char *pkgname, const char *filename);
41 typedef int (*adaptor_clicked_t)(const char *pkgname, const char *filename, const char *event, double timestamp, double x, double y);
42 typedef int (*adaptor_text_signal_t)(const char *pkgname, const char *filename, const char *signal_name, const char *source, widget_event_info_s event_info);
43 typedef int (*adaptor_resize_t)(const char *pkgname, const char *filename, int type);
44 typedef int (*adaptor_create_needed_t)(const char *pkgname, const char *cluster, const char *category);
45 typedef int (*adaptor_change_group_t)(const char *pkgname, const char *filename, const char *cluster, const char *category);
46 typedef int (*adaptor_get_output_info_t)(const char *pkgname, const char *filename, int *w, int *h, double *priority, char **content, char **title);
47 typedef int (*adaptor_initialize_t)(const char *pkgname);
48 typedef int (*adaptor_finalize_t)(const char *pkgname);
49 typedef char *(*adaptor_pinup_t)(const char *pkgname, const char *filename, int pinup);
50 typedef int (*adaptor_is_pinned_up_t)(const char *pkgname, const char *filename);
51 typedef int (*adaptor_system_event_t)(const char *pkgname, const char *filename, int type);
52 typedef int (*adaptor_get_alt_info_t)(const char *pkgname, const char *filename, char **icon, char **name);
53 typedef int (*adaptor_set_content_info_t)(const char *pkgname, const char *filename, const char *content_info);
54
55 struct instance {
56         struct so_item *item;
57         char *id;
58         char *content;
59         char *title;
60         char *icon;     // alternative icon
61         char *name;     // alternative name
62         int w;
63         int h;
64         double priority;
65         char *cluster;
66         char *category;
67 };
68
69 struct so_item {
70         char *so_fname;
71         char *pkgname;
72         void *handle;
73         int timeout;
74         int has_widget_script;
75
76         Eina_List *inst_list;
77
78         struct {
79                 initialize_t initialize;
80                 finalize_t finalize;
81                 create_t create;
82                 destroy_t destroy;
83                 is_updated_t is_updated;
84                 update_content_t update_content;
85                 clicked_t clicked;
86                 text_signal_t text_signal;
87                 resize_t resize;
88                 create_needed_t create_needed;
89                 change_group_t change_group;
90                 get_output_info_t get_output_info;
91                 need_to_destroy_t need_to_destroy;
92                 pinup_t pinup;
93                 is_pinned_up_t is_pinned_up;
94                 system_event_t sys_event;
95                 get_alt_info_t get_alt_info;
96                 set_content_info_t set_content_info;
97         } widget;
98
99         struct {
100                 adaptor_initialize_t initialize;
101                 adaptor_finalize_t finalize;
102                 adaptor_create_t create;
103                 adaptor_destroy_t destroy;
104                 adaptor_is_updated_t is_updated;
105                 adaptor_update_content_t update_content;
106                 adaptor_clicked_t clicked;
107                 adaptor_text_signal_t text_signal;
108                 adaptor_resize_t resize;
109                 adaptor_create_needed_t create_needed;
110                 adaptor_change_group_t change_group;
111                 adaptor_get_output_info_t get_output_info;
112                 adaptor_need_to_destroy_t need_to_destroy;
113                 adaptor_pinup_t pinup;
114                 adaptor_is_pinned_up_t is_pinned_up;
115                 adaptor_system_event_t sys_event;
116                 adaptor_get_alt_info_t get_alt_info;
117                 adaptor_set_content_info_t set_content_info;
118         } adaptor;
119 };
120
121 enum current_operations {
122         WIDGET_OP_UNKNOWN,
123         WIDGET_OP_CREATE,
124         WIDGET_OP_RESIZE,
125         WIDGET_OP_CONTENT_EVENT,
126         WIDGET_OP_NEED_TO_UPDATE,
127         WIDGET_OP_NEED_TO_DESTROY,
128         WIDGET_OP_NEED_TO_CREATE,
129         WIDGET_OP_CHANGE_GROUP,
130         WIDGET_OP_GET_INFO,
131         WIDGET_OP_UPDATE_CONTENT,
132         WIDGET_OP_CLICKED,
133         WIDGET_OP_SYSTEM_EVENT,
134         WIDGET_OP_PINUP,
135         WIDGET_OP_IS_PINNED_UP,
136         WIDGET_OP_DESTROY,
137         WIDGET_OP_GET_ALT_INFO,
138         WIDGET_OP_SET_CONTENT_INFO
139 };
140
141 extern struct instance *so_find_instance(const char *pkgname, const char *filename);
142 extern int so_create(const char *pkgname, const char *filename, const char *content_info, int timeout, int has_widget_script, const char *cluster, const char *category, const char *abi, struct instance **inst);
143 extern int so_is_updated(struct instance *inst);
144 extern int so_need_to_destroy(struct instance *inst);
145 extern int so_update(struct instance *inst);
146 extern int so_destroy(struct instance *inst, int unload);
147 extern int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y);
148 extern int so_script_event(struct instance *inst, const char *signal_name, const char *source, widget_event_info_s event_info);
149 extern int so_resize(struct instance *inst, int w, int h);
150 extern int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi);
151 extern int so_change_group(struct instance *inst, const char *cluster, const char *category);
152 extern int so_get_output_info(struct instance *inst, int *w, int *h, double *priority, char **content, char **title);
153 extern char *so_pinup(struct instance *inst, int pinup);
154 extern int so_is_pinned_up(struct instance *inst);
155 extern int so_sys_event(struct instance *inst, int event);
156 extern int so_get_alt_info(struct instance *inst, char **icon, char **name);
157 extern int so_set_content_info(struct instance *inst, const char *content_info);
158
159 extern enum current_operations so_current_op(void);
160
161 /* End of a file */