EFL 1.7 svn doobies
[profile/ivi/eina.git] / src / include / eina_quadtree.h
1 /* EINA - EFL data type library
2  * Copyright (C) 2010 Cedric BAIL
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library;
16  * if not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef EINA_QUADTREE_H_
20 #define EINA_QUADTREE_H_
21
22 #include "eina_config.h"
23
24 #include "eina_inlist.h"
25
26 typedef struct _Eina_QuadTree      Eina_QuadTree;
27 typedef struct _Eina_QuadTree_Item Eina_QuadTree_Item;
28
29 typedef enum {
30    EINA_QUAD_LEFT,
31    EINA_QUAD_RIGHT,
32    EINA_QUAD_BOTH
33 } Eina_Quad_Direction;
34
35 typedef Eina_Quad_Direction (*Eina_Quad_Callback)(const void *object, size_t middle);
36
37 EAPI Eina_QuadTree      *eina_quadtree_new(size_t w, size_t h, Eina_Quad_Callback vertical, Eina_Quad_Callback horizontal);
38 EAPI void                eina_quadtree_free(Eina_QuadTree *q);
39 EAPI void                eina_quadtree_resize(Eina_QuadTree *q, size_t w, size_t h);
40
41 EAPI void                eina_quadtree_cycle(Eina_QuadTree *q);
42 EAPI void                eina_quadtree_increase(Eina_QuadTree_Item *object);
43
44 EAPI Eina_QuadTree_Item *eina_quadtree_add(Eina_QuadTree *q, const void *object);
45 EAPI Eina_Bool           eina_quadtree_del(Eina_QuadTree_Item *object);
46 EAPI Eina_Bool           eina_quadtree_change(Eina_QuadTree_Item *object);
47 EAPI Eina_Bool           eina_quadtree_hide(Eina_QuadTree_Item *object);
48 EAPI Eina_Bool           eina_quadtree_show(Eina_QuadTree_Item *object);
49
50 EAPI Eina_Inlist        *eina_quadtree_collide(Eina_QuadTree *q, int x, int y, int w, int h);
51 EAPI void               *eina_quadtree_object(Eina_Inlist *list);
52
53 #endif