5c80cbf1d360e114f0f01987035f19adb4b5e869
[apps/home/smartsearch.git] / include / smartsearch.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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.tizenopensource.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
18
19
20
21
22 #ifndef __DEF_SMARTSEARCH_H__
23 #define __DEF_SMARTSEARCH_H__
24
25 #include <glib.h>
26 #include <time.h>
27 #include <Elementary.h>
28 #include <Ecore_X.h>
29 #include <appcore-efl.h>
30 #include <Ecore_IMF.h>
31 #include <vconf.h>
32 #include <aul.h>
33 #include <ui-gadget.h>
34 #include <malloc.h>
35 #include <sqlite3.h>
36 #include <msg_types.h>
37
38 #include "smartsearch_define.h"
39 #include "ps_debug_util.h"
40 #include "search_bar.h"
41 #include "ps_makeupviews.h"
42 #include "ps_app_interface.h"
43 #include "common_util.h"
44 #include "util-func.h"
45
46 #define _EDJ(x)    elm_layout_edje_get(x)
47
48 struct search_more_result{
49         int next_point;
50         int offset;
51         int loop_cnt;
52         int result_cnt;
53         struct appdata *ad;
54 };
55
56 struct search_content_object {
57         int order;
58         Eina_Bool visible;
59         char *name;
60         int string_type;
61         int contents_type;
62         int category_type;
63         char *def_pkg_name;
64         char *obj_icon_path;
65         Elm_Object_Item *gl_result_grp;
66         struct search_more_result mr_info;
67 };
68
69 struct search_category_info {
70         char *btn_icon_path;
71         char *btn_icon_press_path;
72         char *popup_icon_path;
73         char *popup_press_icon_path;
74 };
75
76 struct search_genlist_item_info {
77         int type;
78         struct search_content_object *obj;
79         Elm_Genlist_Item_Class *itc_style;
80         void *data;
81         Elm_Object_Item *parent;
82 };
83
84 struct search_genlist_info {
85         struct search_genlist_item_info *group;
86         GList *itemlist;
87         struct search_genlist_item_info *more;
88 };
89
90 struct search_pipe_data {
91         int cmd;
92         struct search_genlist_info *result_list;
93         int search_ret;
94         struct search_content_object *obj;
95 };
96
97 struct search_item_sel {
98         int type;
99         char path[MAX_LENGTH_PER_PATH];
100         char main_buf[MAX_LENGTH_PER_LINE];
101         char sub_buf[MAX_LENGTH_PER_LINE];
102         char main_id[MAX_LENGTH_PER_ID];
103         char icon1_path[MAX_LENGTH_PER_PATH];
104         char icon2_path[MAX_LENGTH_PER_PATH];
105 };
106
107 struct search_item_more_sel {
108         struct search_content_object *obj;
109 };
110
111 struct appdata {
112         Evas_Object *win_main;
113         Evas_Object *layout_main;
114         Evas_Object *navi_bar;
115         Elm_Object_Item *navi_it;
116
117         double scale_factor;
118
119         Evas_Object *search_entry;
120         Evas_Object *search_bar;
121         Evas_Object *search_cancel_btn;
122         Evas_Object *search_gl;
123         Evas_Object *noresult_view;
124         Evas_Object *sb_layout;
125         Evas_Object *back_btn;
126
127         Evas_Object *ctxpopup;
128         Evas_Object *cate_ctxpopup;
129
130         Evas_Object *cate_btn;
131         Ecore_Idler *idler_search;
132         Ecore_Idler *idler_create_ui;
133         Ecore_Timer *search_timer;
134
135         int touch_x;
136         int touch_y;
137
138         Elm_Genlist_Item_Class *itc_pslist_1line;
139         Elm_Genlist_Item_Class *itc_pslist_1line_1icon;
140         Elm_Genlist_Item_Class *itc_pslist_1line_2icon;
141         Elm_Genlist_Item_Class *itc_pslist_2line_1icon;
142         Elm_Genlist_Item_Class *itc_pslist_2line_2icon;
143         Elm_Genlist_Item_Class *itc_grouptitle;
144         Elm_Genlist_Item_Class *itc_label;
145         Elm_Genlist_Item_Class *itc_listmore;
146
147         Ecore_Pipe *pipe;
148         Ecore_Thread *search_thread;
149         Eina_Condition condition;
150         Eina_Lock mutex;
151
152         char *search_word;
153         char *not_markup_search_word;
154
155         int back_btn_type;
156         int search_category;
157
158         Evas_Object *effect_layout;
159         ui_gadget_h detail_ug;
160
161         sqlite3 *search_db_hd;
162         sqlite3_stmt *search_db_sql[SEARCH_STMT_MAX];
163         struct search_content_object result_obj[SEARCH_CONT_MAX];
164         struct search_category_info category_info[SEARCH_CATE_MAX];
165
166         /* Handle List */
167         msg_handle_t msg_handle;
168 };
169
170 #endif