Support orientation handling.
[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         int orientation;
68 };
69
70 struct so_item {
71         char *so_fname;
72         char *pkgname;
73         void *handle;
74         int timeout;
75         int has_widget_script;
76
77         Eina_List *inst_list;
78
79         struct {
80                 initialize_t initialize;
81                 finalize_t finalize;
82                 create_t create;
83                 destroy_t destroy;
84                 is_updated_t is_updated;
85                 update_content_t update_content;
86                 clicked_t clicked;
87                 text_signal_t text_signal;
88                 resize_t resize;
89                 create_needed_t create_needed;
90                 change_group_t change_group;
91                 get_output_info_t get_output_info;
92                 need_to_destroy_t need_to_destroy;
93                 pinup_t pinup;
94                 is_pinned_up_t is_pinned_up;
95                 system_event_t sys_event;
96                 get_alt_info_t get_alt_info;
97                 set_content_info_t set_content_info;
98         } widget;
99
100         struct {
101                 adaptor_initialize_t initialize;
102                 adaptor_finalize_t finalize;
103                 adaptor_create_t create;
104                 adaptor_destroy_t destroy;
105                 adaptor_is_updated_t is_updated;
106                 adaptor_update_content_t update_content;
107                 adaptor_clicked_t clicked;
108                 adaptor_text_signal_t text_signal;
109                 adaptor_resize_t resize;
110                 adaptor_create_needed_t create_needed;
111                 adaptor_change_group_t change_group;
112                 adaptor_get_output_info_t get_output_info;
113                 adaptor_need_to_destroy_t need_to_destroy;
114                 adaptor_pinup_t pinup;
115                 adaptor_is_pinned_up_t is_pinned_up;
116                 adaptor_system_event_t sys_event;
117                 adaptor_get_alt_info_t get_alt_info;
118                 adaptor_set_content_info_t set_content_info;
119         } adaptor;
120 };
121
122 enum current_operations {
123         WIDGET_OP_UNKNOWN,
124         WIDGET_OP_CREATE,
125         WIDGET_OP_RESIZE,
126         WIDGET_OP_CONTENT_EVENT,
127         WIDGET_OP_NEED_TO_UPDATE,
128         WIDGET_OP_NEED_TO_DESTROY,
129         WIDGET_OP_NEED_TO_CREATE,
130         WIDGET_OP_CHANGE_GROUP,
131         WIDGET_OP_GET_INFO,
132         WIDGET_OP_UPDATE_CONTENT,
133         WIDGET_OP_CLICKED,
134         WIDGET_OP_SYSTEM_EVENT,
135         WIDGET_OP_PINUP,
136         WIDGET_OP_IS_PINNED_UP,
137         WIDGET_OP_DESTROY,
138         WIDGET_OP_GET_ALT_INFO,
139         WIDGET_OP_SET_CONTENT_INFO
140 };
141
142 extern struct instance *so_find_instance(const char *pkgname, const char *filename);
143 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);
144 extern int so_is_updated(struct instance *inst);
145 extern int so_need_to_destroy(struct instance *inst);
146 extern int so_update(struct instance *inst);
147 extern int so_destroy(struct instance *inst, int unload);
148 extern int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y);
149 extern int so_script_event(struct instance *inst, const char *signal_name, const char *source, widget_event_info_s event_info);
150 extern int so_resize(struct instance *inst, int w, int h);
151 extern int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi);
152 extern int so_change_group(struct instance *inst, const char *cluster, const char *category);
153 extern int so_get_output_info(struct instance *inst, int *w, int *h, double *priority, char **content, char **title);
154 extern char *so_pinup(struct instance *inst, int pinup);
155 extern int so_is_pinned_up(struct instance *inst);
156 extern int so_sys_event(struct instance *inst, int event);
157 extern int so_get_alt_info(struct instance *inst, char **icon, char **name);
158 extern int so_set_content_info(struct instance *inst, const char *content_info);
159
160 extern enum current_operations so_current_op(void);
161
162 /* End of a file */