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 #include <Elementary.h>
20 #include "homescreen-efl.h"
22 #include "data_model.h"
24 HAPI Evas_Object *util_create_edje_layout(Evas_Object *parent, const char *edje_filename, const char *edje_group)
26 Evas_Object *layout = NULL;
28 if (!edje_filename || !edje_group) {
29 LOGE("Filename or groupname is NULL");
34 LOGE("Parent is NULL");
38 layout = elm_layout_add(parent);
40 LOGE("Cannot create layout");
44 if (!elm_layout_file_set(layout, edje_filename, edje_group)) {
45 evas_object_del(layout);
46 LOGE("Cannot load layout");
50 evas_object_show(layout);
55 /* TEST FUNCTIONS : TO BE REMOVED*/
56 HAPI void tst_resize_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
58 Evas_Coord x, y, w, h;
60 evas_object_geometry_get(obj, &x, &y, &w, &h);
61 LOGD("Obj_Type[%s] %d %d %d %d", evas_object_type_get(obj), x, y, w, h);
64 HAPI void tst_show_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
70 HAPI void tst_hide_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
75 HAPI void tst_move_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
77 Evas_Coord x, y, w, h;
79 evas_object_geometry_get(obj, &x, &y, &w, &h);
80 LOGD("MSZ %d %d %d %d", x, y, w, h);
83 HAPI void tst_del_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
85 LOGD("tst_del_cb: obj type [%s]", evas_object_type_get(obj));
87 Tree_node_t *t_data = evas_object_data_get(obj, KEY_ICON_DATA);
89 LOGI("[obtained data [%s]]", t_data->data->label);
92 HAPI Eina_List *elm_gengrid_get_evas_objects_from_items(Evas_Object *gengrid)
94 Eina_List *items = NULL;
96 Elm_Object_Item *data = NULL;
98 Eina_List *tmp = NULL;
99 Evas_Object *obj = NULL;
102 LOGE("[INVALID_PARAM][gengrid='%p']", gengrid);
106 tmp = elm_gengrid_realized_items_get(gengrid);
108 LOGE("[FAILED][elm_gengrid_realized_items_get]");
112 EINA_LIST_FOREACH(tmp, it, data) {
116 obj = elm_object_item_part_content_get(data, GRID_CONTENT);
118 LOGE("[FAILED][elm_object_item_part_content_get]");
120 eina_list_free(items);
124 items = eina_list_append(items, obj);
127 LOGE("[FAILED][eina_list_append]");
138 HAPI Elm_Object_Item *elm_gengrid_get_item_at_index(Evas_Object *gengrid, int idx)
140 Eina_List *items = NULL;
141 Elm_Object_Item *found = NULL;
143 if (!gengrid || idx < 0) {
144 LOGE("[INVALID_PARAM][gengrid='%p'][idx='%d']", gengrid, idx);
148 items = elm_gengrid_realized_items_get(gengrid);
150 LOGE("[FAILED][elm_gengrid_realized_items_get]");
154 if (idx > eina_list_count(items)) {
155 LOGE("[INVALID_INDEX]");
156 eina_list_free(items);
160 found = eina_list_nth(items, idx);
161 eina_list_free(items);