The source code moved from the SPIN with license changed to Flora 1.1
[apps/native/home/homescreen-efl.git] / inc / app_icon.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_ICON_H_
18 #define APP_ICON_H_
19
20 #include <Elementary.h>
21 #include <stdbool.h>
22
23 #include "homescreen-efl.h"
24 #include "app_item.h"
25 #include "tree.h"
26
27 typedef struct {
28         char *app_name;
29         char *app_appid;
30 } app_icon_popup_info_t;
31
32 typedef enum {
33         APP_ICON_TYPE_APP = 0,
34         APP_ICON_TYPE_FOLDER,
35         APP_ICON_TYPE_MINIATURE,
36 } app_icon_type_t;
37
38 typedef enum {
39         FOLDER_ICON_FRAME_POSSIBLE = 0,
40         FOLDER_ICON_FRAME_IMPOSSIBLE,
41         FOLDER_ICON_FRAME_NONE,
42 } folder_icon_frame_type_t;
43
44 /**
45  * @brief Sets ignore click flag.
46  *
47  * @param ignore if it is true click event on icon will not be processed.
48  */
49 extern void app_icon_set_click_ignore(bool ignore);
50
51 /**
52  * @brief Remove icon object
53  * @details Function removes elm_layout widget responsible for application
54  * shortcut view. It deletes also elm_image widget (application shortuc image)
55  * with is a child of icon_layout.
56  *
57  * @param icon_layout Evas_Object pointer to item witch will be deleted.
58  */
59 extern void app_icon_destroy(Evas_Object *icon_layout);
60
61 /**
62  * @brief Sets badge number and shows it on application icon.
63  *
64  * @param app_icon_layout application icon layout.
65  * @param int number with will be displayed in badge layout.
66  */
67 extern void app_icon_show_badge(Evas_Object *app_icon_layout,
68         const unsigned int number);
69
70 /**
71  * @brief Hides badge icon on application.
72  * @details [long description]
73  * @param application icon layout pointer.
74  */
75 extern void app_icon_hide_badge(Evas_Object *app_icon_layout);
76
77 /**
78  * @brief Sets icon label visible
79  * @param app_icon_layout pointer to icon layout.
80  */
81 extern void app_icon_show_label(Evas_Object *app_icon_layout);
82
83 /**
84  * @brief Sets icon label invisible.
85  * @param app_icon_layout pointer to icon layout.
86  */
87 extern void app_icon_hide_label(Evas_Object *app_icon_layout);
88
89 /**
90  * @brief Function chage state of icon regarind to passed view type
91  *
92  * @param icon Pointer to icon object which should be changed.
93  * @param view view type
94  * @param in_folder value indicating whether given item is in folder
95  *
96  * @return true if success
97  */
98 bool app_icon_set_view_mode(Evas_Object *icon, homescreen_view_t view,
99         bool in_folder);
100
101 /**
102  * @brief Creates icon using app_item_t structure
103  *
104  * @param parent Parent widget pointer
105  * @param item pointer to app_item_t structure
106  *
107  * @return Pointer to created icon or NULL.
108  */
109 Evas_Object *app_icon_create(Tree_node_t *tree_data, app_icon_type_t type);
110
111 /**
112  * @brief Updates miniatures in folder icon
113  *
114  * @param folder_icon_layout folder icon layout to update
115  * @param folder_miniatures list of miniatures shown in folder icon
116  * @param folder_app_tree applications on the first page of folder
117  */
118 void app_icon_update_folder_icon(Tree_node_t *folder_node);
119
120 /**
121  * @brief Highlights folder icon with specified frame type
122  *
123  * @param folder_icon_layout folder icon layout to highlight
124  * @param frame_type type of frame to use on folder icon
125  */
126 void app_icon_highlight_folder_icon(Evas_Object *folder_icon_layout,
127         folder_icon_frame_type_t frame_type);
128
129 /**
130  * @brief Sets icon's label
131  *
132  * @param icon_layout icon layout in which label is set
133  * @param label label to set
134  */
135 void app_icon_set_label(Evas_Object *icon_layout, const char* label);
136
137 /**
138  * @brief Sets icon layout's color
139  *
140  * @param icon_layout icon layout to set color
141  * @param r red component of given color
142  * @param g green component of given color
143  * @param b blue component of given color
144  * @param a alpha component of given color
145  */
146 void app_icon_set_color(Evas_Object *icon_layout, int r, int g, int b, int a);
147
148 /**
149  * @brief Sets icon's label color to black
150  *
151  * @param icon_layout icon layout in which label's color is changed
152  */
153 void app_icon_set_label_black(Evas_Object *icon_layout);
154
155 /**
156  * @brief Removes all data connected with icon_layout
157  * @param icon_layout Pointer to app_icon layout.
158  */
159 void app_icon_remove(Evas_Object *icon_layout);
160
161 #endif /* APP_ICON_H_ */