2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://floralicense.org/license/
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.
17 #ifndef __HOME_SCREEN_UTIL_H__
18 #define __HOME_SCREEN_UTIL_H__
21 #include <Elementary.h>
29 #define LOG_TAG "HOMESCREEN_EFL"
33 #define _(str) gettext(str)
37 #define HAPI __attribute__((visibility("hidden")))
38 #define DAPI __attribute__((visibility("default")))
41 ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
43 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
46 #define LOGD(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
50 #define LOGW(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
54 #define LOGE(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
58 #define LOGI(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s[%d]\t " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
62 * @brief Creates elm_layout widget and load edje file to it.
64 * @param win Homescreen efl window pointer.
65 * @param edje_filename name of the edje file
66 * @param edje_group group name from the edje file
67 * @return elm_layout Evas_Object pointer.
69 extern Evas_Object *util_create_edje_layout(
70 Evas_Object *win, const char* edje_filename, const char* edje_group);
72 /*DBG callbacks set. Please use it if new objects are not visible .etc*/
73 extern void tst_resize_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
74 extern void tst_show_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
75 extern void tst_hide_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
76 extern void tst_move_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
77 extern void tst_del_cb(void *data, Evas *e, Evas_Object *obj, void *ei);
82 * @brief Function returns Eina list of evas objects visible in gengrid
84 * @param gengrid Evas_Object pointer to elm_gengrid
85 * @return Eina_List pointer which Evas_Objects
87 extern Eina_List *elm_gengrid_get_evas_objects_from_items(Evas_Object *gengrid);
90 * @brief Function returns pointer to elm_object_item placed in gengrid
91 * at specified position
92 * @param gengrid Pointer to elm_gengrid_widget;
94 * @return Pointer to elm_object_item
96 Elm_Object_Item *elm_gengrid_get_item_at_index(Evas_Object *gengrid, int idx);
99 * @brief Application sub-directories type.
106 APP_DIR_SHARED_RESOURCE,
107 APP_DIR_SHARED_TRUSTED,
108 APP_DIR_EXTERNAL_DATA,
109 APP_DIR_EXTERNAL_CACHE,
110 APP_DIR_EXTERNAL_SHARED_DATA,
114 * @brief Returns absolute path to resource file located in applications directory.
116 * @param subdir type of subdirectory
117 * @param relative path of resource from starting from "data" dir.
118 * eg. for DATA_DIR subdir and relative "database.db" => "/home/owner/apps/org.tizen.homescreen-efl/data/database.db"
119 * @return absolute path string.
121 const char *util_get_file_path(enum app_subdir dir, const char *relative);
124 * @brief Convinience macros
126 #define util_get_data_file_path(x) util_get_file_path(APP_DIR_DATA, (x))
127 #define util_get_cache_file_path(x) util_get_file_path(APP_DIR_CACHE, (x))
128 #define util_get_res_file_path(x) util_get_file_path(APP_DIR_RESOURCE, (x))
129 #define util_get_shared_data_file_path(x) util_get_file_path(APP_DIR_SHARED_DATA, (x))
130 #define util_get_shared_res_file_path(x) util_get_file_path(APP_DIR_SHARED_RESOURCE, (x))
131 #define util_get_trusted_file_path(x) util_get_file_path(APP_DIR_SHARED_TRUSTED, (x))
132 #define util_get_external_data_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_DATA, (x))
133 #define util_get_external_cache_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_CACHE, (x))
134 #define util_get_external_shared_data_file_path(x) util_get_file_path(APP_DIR_EXTERNAL_SHARED_DATA, (x))
136 #endif /* __HOME_SCREEN_UTIL_H__ */