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.
20 #include <Elementary.h>
26 * @brief Check interection between @p rect and list items bounding
28 * @details Check interection between @p rect and list items bounding
30 * If current list item == @p obj the intersection check won't be performed.
31 * By standard the @p rect is the @p obj bounding rectangle.
32 * So this helps to avoid interesction check with obj itself
33 * @param rect rectangle
34 * @param obj filter object. Can be NULL
35 * @param list of objects
36 * @return TRUE if intersection was found ELSE otherwise
38 extern bool livebox_utils_check_rect_list_grid_interesction(
39 Eina_Rectangle *rect, Evas_Object *obj, Eina_List *list);
42 * @brief Returns the list of liveboxes on grid
43 * @details Function returns liveboxes put on @p grid but but without the
46 * @return list of liveboxes. Has to be freed
48 extern Eina_List *livebox_utils_get_liveboxes_on_gird(Evas_Object *grid);
51 * @brief Returns the list of liveboxes on page
52 * @details Page is a layout described by "livebox_container.edc" Which
53 * contains a elm_grid object. All objects in the grid are returned.
54 * @param obj livebox page
55 * @return list of liveboxes. Has to be freed
57 extern Eina_List *livebox_utils_get_liveboxes_on_page_list(Evas_Object *obj);
61 * @brief Returns the livebox container that contains the selected livebox
62 * @return Livebox container
64 extern Evas_Object *livebox_utils_get_selected_livebox_layout(void);
67 * @brief Returns the that previously contained the selected livebox.
68 * Used when livebox in repositioned to different container
69 * @return Livebox container
71 extern Evas_Object *livebox_utils_get_prev_livebox_layout(void);
74 * @brief Returns the selected livebox
75 * @return selected livebox
77 extern Evas_Object *livebox_utils_selected_livebox_get(void);
80 * @brief Sets the selected livebox
81 * @note Use this when livebox is selected
82 * @param livebox Selected livebox
83 * @param layout livbox container holding the selected livebox
85 extern void livebox_utils_set_selected_livebox(Evas_Object *livebox,
89 * @brief Crate the shadow visible when a object is repositioned
90 * @param parent Shadow parent
92 extern void livebox_utils_create_shadow(Evas_Object *parent);
95 * @brief Pack the shadow object to given container based on livebox position
96 * @note Used in reposition
97 * @param livebox item repositioned using drag&drop
98 * @param page container where the shadow will be packed
100 extern void livebox_utils_set_shadow_pack(Evas_Object *livebox,
104 * @brief Shadow is repacked from one livebox_container to different one
105 * @details Shadow object is unpacked from its current grid and packed to grid
106 * in page_to livebox_container
107 * @param livebox livebox item repositioned using drag&drop
108 * @param page_to livebo_container where the shadow will be packed
110 extern void livebox_utils_repack_shadow(Evas_Object *livebox,
111 Evas_Object *page_to);
114 * @brief Sets the visiblity of the shadow object
115 * @param visible TRUE shadow will be visible
117 extern void livebox_utils_set_shadow_visibility(bool visible);
120 * @brief Creates the clipper for the shadow object
121 * @details The clipper is added to the @p livebox_container and is clipped
122 * by the shadow object.
123 * This way only the part of the clipper will be visible where the repositioned
124 * livebox can be dropped
125 * @param livebox_container Layout containing the clipper
127 extern void livebox_utils_create_grid_shadow_clipper(Evas_Object*
131 * @brief Returns position fitting given grid
132 * @details The input parameteters should be given in virtual coordinates of
133 * a grid. If the item coordinates don't fit the grid they will be modified
141 * if obj_x + obj_w > grid_width
143 * *out_x = grid_width - obj_w
154 extern void livebox_utils_normalize_grid_pos(int obj_x, int obj_y, int obj_w,
155 int obj_h, int *out_x, int *out_y);
158 * @brief Returns the grid put into the @p container widget
159 * @param container The container wodth grid
160 * @return Grid object or NULL on error
162 extern Evas_Object *livebox_utils_get_livebox_container_grid(Evas_Object *container);
165 * @brief Returns the shadow object
166 * @return shadow object
168 extern Evas_Object *livebox_utils_get_shadow(void);
171 * @brief unpacks the grid object from the grid its currently packed to
173 extern void livebox_utils_shadow_unpack(void);
176 * @brief Transforms the @p livebox geometry to @p grid virtual coordinates
177 * @param[in] livebox object to read the geometry from
178 * @param[in] grid elm_grid which virtual coordinates will be used
179 * @param[out] out_x @p livebox transformed horizontal position
180 * @param[out] out_y @p livebox transformed vertical position
181 * @param[out] out_w @p livebox transformed width
182 * @param[out] out_h @p livebox transformed height
184 extern void livebox_utils_convert_size_to_grid_coord(Evas_Object *livebox,
185 Evas_Object *grid, int *out_x, int *out_y, int *out_w, int *out_h);
188 * @brief Sets the packing of @p item_to_pack to the @p grid
189 * @details The @p livebox object is used to determine the position of @p
190 * item_to_pack in the @p grid.
191 * Note that the @p item_to_pack has to be packet in the gird allready
192 * @param livebox Position of this object will be used to determine the
193 * position of @p item_to_pack in the @p grid
194 * @param item_to_pack Object to be packed to the @p grid
195 * @param grid The grid object. Must be elm_grid
197 extern void livebox_utils_set_grid_object_pack(Evas_Object *livebox,
198 Evas_Object *item_to_pack, Evas_Object *grid);
201 * @brief Repacks @p item_to_pack from @p grid_from to @p grid_to
202 * @details The @p livebox object is used to determine the position of @p
203 * item_to_pack in the @p grid_to.
204 * The item_to_pack will be unpacked from @p grid_from and @p packed to @p
207 * @param livebox ivebox Position of this object will be used to determine
208 * the position of @p item_to_pack in the @p grid_to
209 * @param item_to_pack Repacked item
210 * @param grid_from Source grid
211 * @param grid_to D Destination grid
213 extern void livebox_utils_repack_grid_object(Evas_Object *livebox,
214 Evas_Object *item_to_pack, Evas_Object *grid_from,
215 Evas_Object *grid_to);
218 * @brief Transforms virtual @ grid virtual coordinates to screen coordinates
219 * @param grid elm_grid
220 * @param x Horizontal position in @p grid
221 * @param y Vertical position in @p grid
222 * @param w Width in @p grid
223 * @param h Height in @p grid
224 * @return Eina_Rectangle containing the postion transformed
225 * to screen coordinates
227 extern Eina_Rectangle *livebox_utils_convert_virtual_grid_geo_to_screen(
228 Evas_Object *grid, int x, int y, int w, int h);
231 * @brief Returns the bounding rectangle of the @p obj object
232 * @details Bounding rectangle contains (x position, y position, width, height)
234 * @param obj to get the bounding rectangle from
235 * @return Bounding rectangle
237 extern Eina_Rectangle *livebox_utils_get_widget_rectangle(Evas_Object *obj);
240 * @brief Returns the bounding rectangle of the @p obj object in grid virtual
242 * @details Bounding rectangle contains (x position, y position, width, height)
244 * @p Obj has to be packed into a grid.
245 * @param obj to get the bounding rectangle from
246 * @return Bounding rectangle
248 extern Eina_Rectangle *livebox_utils_get_grid_widget_rectangle(
252 * @brief get the current cursor position
253 * @param mx position x
254 * @param my position y
256 extern void livebox_utils_get_cursor_pos(int *mx, int *my);
259 #endif /* UTILS_H_ */