Tizen 2.4.0 rev3 SDK Public Release
[apps/home/attach-panel.git] / include / attach_panel_internal.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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 __TIZEN_ATTACH_PANEL_INTERNAL_H__
18 #define __TIZEN_ATTACH_PANEL_INTERNAL_H__
19
20 #include <Elementary.h>
21 #include <app_control.h>
22
23 #define DATA_KEY_ATTACH_PANEL "__dkap__"
24 #define DATA_KEY_ATTACH_PANEL_INFO "__dkapi__"
25 #define DATA_KEY_EDGE_TOP "__dket__"
26 #define DATA_KEY_PAGE "__dkpg__"
27 #define DATA_KEY_UG "__dkug__"
28
29 #define SELECTION_MODE_SINGLE "single"
30 #define SELECTION_MODE_MULTIPLE "multiple"
31
32 #define MODE_ENABLE "enable"
33 #define MODE_DISABLE "disable"
34 #define MODE_TRUE "true"
35 #define MODE_FALSE "false"
36
37 #define TABBAR_NAME_MORE "More"
38 #define BUF_SIZE 128
39
40 /*
41  * attach-panel(Caller) <-> UGs & Apps operations
42  *
43  * - ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
44  *   appid : "attach-panel-gallery"
45  *   operation : APP_CONTROL_OPERATION_PICK
46  *   mime : "image/(asterisk)"
47  *   extra_data : See below
48  *   1) APP_CONTROL_DATA_SELECTION_MODE : "single"
49  *   2) "http://tizen.org/appcontrol/data/total_count" : any numbers
50  *   3) "http://tizen.org/appcontrol/data/total_size" : any bytes
51  *   return data : See below
52  *   1) "http://tizen.org/appcontrol/data/selected"
53  *
54  * - ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
55  *   appid : "attach-panel-camera"
56  *   operation : APP_CONTROL_OPERATION_CREATE_CONTENT
57  *   mime : NULL
58  *   extra_data : See below
59  *   1) APP_CONTROL_DATA_SELECTION_MODE : "single"
60  *   2) "http://tizen.org/appcontrol/data/total_size" : any bytes
61  *   return data : See below
62  *   1) "http://tizen.org/appcontrol/data/selected"
63  *
64  * - ATTACH_PANEL_CONTENT_CATEGORY_VOICE
65  *   appid : "attach-panel-voicerecorder"
66  *   operation : APP_CONTROL_OPERATION_CREATE_CONTENT
67  *   mime : NULL
68  *   extra_data : See below
69  *   1) APP_CONTROL_DATA_SELECTION_MODE : "single"
70  *   2) "http://tizen.org/appcontrol/data/total_size" : any bytes
71  *   return data : See below
72  *   1) "http://tizen.org/appcontrol/data/selected"
73  *
74  * - ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
75  *   appid : NULL
76  *   operation : APP_CONTROL_OPERATION_PICK
77  *   mime : "video/(asterisk)"
78  *   extra_data : See below
79  *   1) APP_CONTROL_DATA_SELECTION_MODE : "multiple"
80  *   2) "http://tizen.org/appcontrol/data/total_count" : any numbers
81  *   3) "http://tizen.org/appcontrol/data/total_size" : any bytes
82  *   return data : See below
83  *   1) "http://tizen.org/appcontrol/data/selected"
84  *
85  * - ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
86  *   appid : NULL
87  *   operation : APP_CONTROL_OPERATION_PICK
88  *   mime : "audio/(asterisk)"
89  *   extra_data : See below
90  *   1) APP_CONTROL_DATA_SELECTION_MODE : "multiple"
91  *   2) "http://tizen.org/appcontrol/data/total_count" : any numbers
92  *   3) "http://tizen.org/appcontrol/data/total_size" : any bytes
93  *   return data : See below
94  *   1) "http://tizen.org/appcontrol/data/selected"
95  *
96  * - ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
97  *   appid : NULL
98  *   operation : APP_CONTROL_OPERATION_PICK
99  *   mime : "application/vnd.tizen.calendar"
100  *   extra_data : See below
101  *   1) APP_CONTROL_DATA_SELECTION_MODE : "multiple"
102  *   2) "http://tizen.org/appcontrol/data/mode" : 1
103  *   3) "http://tizen.org/appcontrol/data/type" : "vcs"
104  *   4) "http://tizen.org/appcontrol/data/total_count" : any numbers
105  *   return data : See below
106  *   1) "http://tizen.org/appcontrol/data/selected"
107  *
108  * - ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
109  *   appid : NULL
110  *   operation : APP_CONTROL_OPERATION_PICK
111  *   mime : "application/vnd.tizen.contact"
112  *   extra_data : See below
113  *   1) APP_CONTROL_DATA_SELECTION_MODE : "multiple"
114  *   2) "http://tizen.org/appcontrol/data/type" : "vcf"
115  *   return data : See below
116  *   1) "http://tizen.org/appcontrol/data/selected"
117  *
118  * - ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
119  *   appid : NULL
120  *   operation : APP_CONTROL_OPERATION_PICK
121  *   mime : NULL
122  *   extra_data : See below
123  *   1) APP_CONTROL_DATA_SELECTION_MODE : "multiple"
124  *   2) "http://tizen.org/appcontrol/data/total_count" : any numbers
125  *   3) "http://tizen.org/appcontrol/data/total_size" : any bytes
126  *   return data : See below
127  *   1) "http://tizen.org/appcontrol/data/selected"
128  *
129  * - ATTACH_PANEL_CONTENT_CATEGORY_VIDEO_RECORDER
130  *   appid : NULL
131  *   operation : APP_CONTROL_OPERATION_CREATE_CONTENT
132  *   mime : "video/3gp"
133  *   extra_data : See below
134  *   1) APP_CONTROL_DATA_SELECTION_MODE : "single"
135  *   2) "http://tizen.org/appcontrol/data/total_count" : any numbers
136  *   3) "http://tizen.org/appcontrol/data/total_size" : any bytes
137  *   return data : See below
138  *   1) "http://tizen.org/appcontrol/data/selected"
139
140  */
141
142
143 /*
144  * attach-panel(Caller) <-> ui-gadgets(Callee) protocol
145  *
146  * - Caller send
147  *   key : "__CALLER_PANEL__"
148  *   value : "attach-panel"
149  *   when : ug_create()
150  *
151  *   key : APP_CONTROL_DATA_SELECTION_MODE
152  *   value : SELECTION_MODE_MULTIPLE
153  *   when : full mode
154  *   how : ug_send_message()
155  *
156  *   key : APP_CONTROL_DATA_SELECTION_MODE
157  *   value : SELECTION_MODE_SINGLE
158  *   when : half mode
159  *   how : ug_send_message()
160  *
161  *   key : "__ATTACH_PANEL_INITIALIZE__"
162  *   value : "enable"
163  *   when : attach_panel_show()
164  *   how : ug_send_message()
165  *
166  *   key : "__ATTACH_PANEL_SHOW_CONTENT_CATEGORY__"
167  *   value : "true" or "false"
168  *   when : set as true when the content category is shown, and false when it is hidden.
169  *   how : ug_send_message()
170  *
171  * - Callee send
172  *   key : "__ATTACH_PANEL_FLICK_DOWN__"
173  *   value : "enable" or "disable"
174  *   when : ug is full, then ug has events.
175  *   how : ug_send_result()
176  *
177  *   key : "__ATTACH_PANEL_FULL_MODE__"
178  *   value : "enable"
179  *   when : ug needs to be shown on the full mode
180  *   how : ug_send_result()
181  *
182  *   key : "__ATTACH_PANEL_SHOW_TOOLBAR__"
183  *   value : "true" or "false"
184  *   when : set as true when the panel's tabbar needs to be shown, and false when it needs to be hidden.
185  *   how : ug_send_result()
186  *
187  *   key : "__ATTACH_PANEL_SHOW_PANEL__"
188  *   value : "true" or "false"
189  *   when : set as true when the panel it needs to be shown, and false when it needs to be hidden.
190  *   how : ug_send_result()
191  */
192
193
194
195 enum {
196         ATTACH_PANEL_CONTENT_CATEGORY_APP = 0,
197         ATTACH_PANEL_CONTENT_CATEGORY_UG,
198 };
199
200
201
202 typedef enum {
203         ATTACH_PANEL_STATE_HIDE,
204         ATTACH_PANEL_STATE_HALF,
205         ATTACH_PANEL_STATE_FULL,
206 } attach_panel_state_e;
207
208
209
210 struct _attach_panel {
211         Evas_Object *win;
212         Evas_Object *attach_panel_rect;
213         Evas_Object *conformant;
214         Evas_Object *ui_manager;
215         Evas_Object *toolbar;
216         Evas_Object *scroller;
217         Evas_Object *gesture;
218         Evas_Object *grid;
219         Evas_Object *grid_page;
220         Elm_Object_Item *grid_tabbar_item;
221
222         Eina_List *content_list;
223
224         Ecore_Idler *append_idler;
225
226         attach_panel_state_e attach_panel_port_state;
227         attach_panel_state_e attach_panel_land_state;
228         attach_panel_result_cb result_cb;
229         void *result_data;
230         attach_panel_event_cb event_cb;
231         void *event_data;
232
233         Evas_Coord transit_width;
234         Evas_Coord transit_height;
235
236         Eina_Bool is_delete;
237         Eina_Bool rotate;
238         Eina_Bool flick;
239         int cur_page_no;
240         int cur_event_state;
241         int magic_no;
242 };
243 typedef struct _attach_panel attach_panel_s;
244
245
246
247 struct _innate_content {
248         /* default information */
249         const char *appid;
250         const char *name;
251         const char *icon;
252         const char *tabbar_name;
253         int content_category;
254         int is_ug;
255
256         /* launching features */
257         const char *operation;
258         const char *type;
259         const char *item_type;
260         const char *selection_mode;
261         const char *mime;
262         int mode;
263         int max;
264 };
265 typedef struct _innate_content innate_content_s;
266
267
268
269 struct _content {
270         attach_panel_s *attach_panel;
271         innate_content_s *innate_content_info;
272         Elm_Object_Item *tabbar_item;
273         Elm_Object_Item *grid_item;
274         Evas_Object *content;
275         Evas_Object *page;
276         bundle *extra_data;
277         int index;
278         int order;
279 };
280 typedef struct _content content_s;
281
282
283
284 extern void _attach_panel_del(attach_panel_s *attach_panel);
285
286
287
288 #endif // __TIZEN_ATTACH_PANEL_INTERNAL_H__