Restore gbs build
[apps/native/home/homescreen-efl.git] / inc / util.h
1 /*
2  * Copyright 2012  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 #ifndef __HOME_SCREEN_UTIL_H__
18 #define __HOME_SCREEN_UTIL_H__
19
20 #include <dlog.h>
21 #include <Elementary.h>
22 #include <stdbool.h>
23
24 #define BUF_SIZE 64
25
26 /* Multi-language */
27 #ifndef _
28 #define _(str) gettext(str)
29 #endif
30
31 /* Build */
32 #define HAPI __attribute__((visibility("hidden")))
33 #define DAPI __attribute__((visibility("default")))
34
35 #define COUNT_OF(x) \
36 ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
37
38
39 /**
40  * @brief Creates elm_layout widget and load edje file to it.
41  *
42  * @param win Homescreen efl window pointer.
43  * @param edje_filename  name of the edje file
44  * @param edje_group group name from the edje file
45  * @return elm_layout Evas_Object pointer.
46  */
47 extern Evas_Object *util_create_edje_layout(
48         Evas_Object *win, const char* edje_filename, const char* edje_group);
49
50 /*DBG callbacks set. Please use it if new objects are not visible .etc*/
51 extern void tst_resize_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
52 extern void tst_show_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
53 extern void tst_hide_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
54 extern void tst_move_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
55 extern void tst_del_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
56
57
58
59 /**
60  * @brief Function returns Eina list of evas objects visible in gengrid
61  *
62  * @param gengrid Evas_Object pointer to elm_gengrid
63  * @return Eina_List pointer which Evas_Objects
64  */
65 extern Eina_List *elm_gengrid_get_evas_objects_from_items(Evas_Object *gengrid);
66
67 /**
68  * @brief Function returns pointer to elm_object_item placed in gengrid
69  * at specified position
70  * @param gengrid Pointer to elm_gengrid_widget;
71  * @param idx
72  * @return Pointer to elm_object_item
73  */
74 Elm_Object_Item *elm_gengrid_get_item_at_index(Evas_Object *gengrid, int idx);
75
76 /*
77  * @brief Application sub-directories type.
78  */
79 enum app_subdir {
80         APP_DIR_DATA,
81         APP_DIR_CACHE,
82         APP_DIR_RESOURCE,
83         APP_DIR_SHARED_DATA,
84         APP_DIR_SHARED_RESOURCE,
85         APP_DIR_SHARED_TRUSTED,
86         APP_DIR_EXTERNAL_DATA,
87         APP_DIR_EXTERNAL_CACHE,
88         APP_DIR_EXTERNAL_SHARED_DATA,
89 };
90
91 /**
92  * @brief Returns absolute path to resource file located in applications directory.
93  *
94  * @param subdir type of subdirectory
95  * @param relative path of resource from starting from "data" dir.
96  *        eg. for DATA_DIR subdir and relative "database.db" => "/home/owner/apps/org.tizen.homescreen-efl/data/database.db"
97  * @return absolute path string.
98  */
99 const char *util_get_file_path(enum app_subdir dir, const char *relative);
100
101 /**
102  * @brief Convinience macros
103  */
104 #define util_get_data_file_path(x) util_get_file_path(APP_DIR_DATA, (x))
105 #define util_get_cache_file_path(x) util_get_file_path(APP_DIR_CACHE, (x))
106 #define util_get_res_file_path(x) util_get_file_path(APP_DIR_RESOURCE, (x))
107 #define util_get_shared_data_file_path(x) util_get_file_path(APP_DIR_SHARED_DATA, (x))
108 #define util_get_shared_res_file_path(x) util_get_file_path(APP_DIR_SHARED_RESOURCE, (x))
109 #define util_get_trusted_file_path(x) util_get_file_path(APP_DIR_SHARED_TRUSTED, (x))
110 #define util_get_external_data_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_DATA, (x))
111 #define util_get_external_cache_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_CACHE, (x))
112 #define util_get_external_shared_data_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_SHARED_DATA, (x))
113
114 #endif /* __HOME_SCREEN_UTIL_H__ */