The source code moved from the SPIN with license changed to Flora 1.1
[apps/native/home/homescreen-efl.git] / inc / app_item.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_ITEM_H_
18 #define APP_ITEM_H_
19
20 #include <stdbool.h>
21 #include <Elementary.h>
22
23 typedef enum {
24         APP_ITEM_ROOT = 0,
25         APP_ITEM_HOME,
26         APP_ITEM_ALL_APPS_ROOT,
27         APP_ITEM_PAGE,
28         APP_ITEM_ICON,
29         APP_ITEM_FOLDER,
30         APP_ITEM_WIDGET
31 } app_item_type_t;
32
33 typedef struct {
34         app_item_type_t type;
35         int unique_id; /*from db table; used for composing tree structure when
36         reading flattened db representation*/
37         char *label; /*this is the name of the application
38         viewed in homescreen layout*/
39         const char *icon;
40         const char *exec; /*app exec path - used for notifications*/
41         const char *appid;
42         unsigned int badge_count; /*notification count viewed in icon badge*/
43         void *data; /*pointer is used by folder to store the folder layout.*/
44         bool removable;
45         bool is_checked;
46         Evas_Object *layout;
47         Elm_Object_Item *grid_item;
48         int col;
49         int row;
50         int col_span;
51         int row_span;
52
53         char *content_info;
54 } app_item_t;
55
56 /**
57  * @brief creates new app_item_t object
58  * @param type object type
59  * @param unique_id object id
60  * @param label label text
61  * @param icon path to icon
62  * @param exec app to exec on click
63  * @param appid application id
64  * @param data extra data
65  * @param is_removeable na the app be removed
66  * @param col object column (used only for widgets)
67  * @param row object row (used only for widgets)
68  * @param col_span object column span (used only for widgets)
69  * @param row_span object row span (used only for widgets)
70  * @return
71  */
72 app_item_t *app_item_create(const app_item_type_t type, const int unique_id,
73         const char *label, const char *icon, const char *exec,
74         const char *appid, void *data, bool is_removeable,
75         int col, int row, int col_span, int row_span,
76         const char *content_info);
77
78 /**
79  * @brief Function frees all data connected with the item
80  * @param item Pointer to application item.
81  */
82 void app_item_free(app_item_t *item);
83
84 /**
85  * @brief updates app_item_geometry
86  * @param app_item app_item to be updated
87  * @param x new pos
88  * @param y new pos
89  * @param w new width
90  * @param h new height
91  */
92 void app_item_geometry_update(app_item_t *app_item, int x, int y, int w, int h);
93
94 void app_item_update_content_info(app_item_t *app_item, const char *content_info);
95
96 #endif /* APP_ITEM_H_ */