The source code moved from the SPIN with license changed to Flora 1.1
[apps/native/home/homescreen-efl.git] / inc / app_grid.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 APP_GRID_H_
18 #define APP_GRID_H_
19
20 #include <Elementary.h>
21 #include "homescreen-efl.h"
22 #include "tree.h"
23
24 typedef enum {
25         APP_GRID_TYPE_ALL_APPS = 0,
26         APP_GRID_TYPE_FOLDER
27 } app_grid_type_t;
28 /**
29  * @brief Function creates app_grid wgt
30  * @details This is a kind of wrapper for a gengrid widget but handle drag and
31  * drop events between different gengrids created by this function. Reposition
32  * mechanism found active gengrid behind mouse pointer. Reposition is gengeric.
33  * If you want to modify it you should set some callbacks in function
34  * app_grid_custom_dnd_handlers_set.
35  *
36  * @param parent Pointer to eveas_object. Smart parent widget for app grid.
37  * Basically you can add it into win.
38  * @param data Pointer to Eina_List object with content will be inserted in
39  * applicaiton list.
40  * @param item_width int describes width of an item in grid.
41  * @param item_height ind describes height of an item in grid
42  * @return pointer to created app_grid
43  */
44 extern Evas_Object *app_grid_create(Evas_Object *parent, Tree_node_t *data,
45         Evas_Coord gengrid_width, Evas_Coord gengrid_height,
46         app_grid_type_t type);
47
48 /**
49  * @brief Append an imte inot app_grid
50  * @param app_grid Pointer to elm_gengrid widget
51  * @param icon_to_append pointer to appended item
52  *
53  * @return Elm_Object_Item if no errors, otherwise NULL
54  */
55 extern Elm_Object_Item *app_grid_append_item(Evas_Object *app_grid,
56         Evas_Object *icon_to_append);
57
58 /**
59  * @brief Function inserts an item into specific position. If idx is inproper
60  * function tries to insert item at the end of the grid.
61  *
62  * @param app_grid Pointer to app_grid
63  * @param item Pointer to item evas_object
64  * @param idx index where item should be inserted
65  *
66  * @return Elm_Object_Item if no errors, otherwise NULL
67  */
68 extern Elm_Object_Item *app_grid_insert_item_relative(Evas_Object *app_grid,
69         Evas_Object *item, Elm_Object_Item *rel_it);
70
71 /**
72  * @brief Function change state of app grids in homescreen
73  *
74  * @param app_grid Pointer to elm_layout widget
75  * @param view type of view mode
76  */
77 extern void app_grid_set_view_mode(Evas_Object *app_grid,
78         homescreen_view_t view);
79
80 /**
81  * @brief Function unpack item from the app_grid
82  *
83  * @param item pointer to stored data model
84  */
85 extern void app_grid_unpack_item(Elm_Object_Item *item);
86
87 /**
88  * @brief Function pack object to box
89  */
90 extern Evas_Object *app_grid_item_pack(Evas_Object *p, Evas_Object *c);
91
92 /**
93  * @brief Function get icon and data from app_grid item
94  */
95 extern Eina_Bool app_grid_get_item_content(Elm_Object_Item *item,
96         Evas_Object **icon, Tree_node_t **data);
97
98 #endif /* APP_GRID_H_ */