tizen 2.3 release
[framework/uifw/elementary.git] / src / lib / elm_gen_common.h
1 #ifndef ELM_GEN_H_
2 #define ELM_GEN_H_
3
4 #include <Elementary.h>
5 #include <Elementary_Cursor.h>
6 #include "elm_priv.h"
7
8 #define ELM_GEN_ITEM_FROM_INLIST(it) \
9   ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
10
11 #define SWIPE_MOVES 12
12
13 /* common item handles for genlist/gengrid */
14
15 typedef struct Elm_Gen_Item_Type    Elm_Gen_Item_Type;
16 typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
17
18 struct Elm_Gen_Item_Tooltip
19 {
20    const void                 *data;
21    Elm_Tooltip_Item_Content_Cb content_cb;
22    Evas_Smart_Cb               del_cb;
23    const char                 *style;
24    Eina_Bool                   free_size : 1;
25 };
26
27 struct Elm_Gen_Item
28 {
29    ELM_WIDGET_ITEM;
30    EINA_INLIST;
31
32    Elm_Gen_Item_Type        *item;
33    const Elm_Gen_Item_Class *itc;
34    Evas_Coord                x, y, dx, dy;
35    Evas_Object              *spacer, *deco_all_view;
36    Elm_Gen_Item             *parent;
37    Eina_List                *texts, *contents, *states, *content_objs;
38    Ecore_Timer              *long_timer;
39    int                       walking;
40    int                       generation; /**< a generation of an item. when the item is created, this value is set to the value of genlist generation. this value will be decreased when the item is going to be deleted */
41    const char               *mouse_cursor;
42
43    struct
44    {
45       Evas_Smart_Cb func;
46       const void   *data;
47    } func;
48
49    Elm_Gen_Item_Tooltip      tooltip;
50    Ecore_Cb                  del_cb, unrealize_cb;
51    Ecore_Cb                  sel_cb, unsel_cb;
52    Ecore_Cb                  highlight_cb, unhighlight_cb;
53
54    int                       position;
55    Elm_Object_Select_Mode    select_mode;
56
57    Eina_Bool                 position_update : 1;
58    Eina_Bool                 want_unrealize : 1;
59    Eina_Bool                 realized : 1;
60    Eina_Bool                 selected : 1;
61    Eina_Bool                 highlighted : 1;
62    Eina_Bool                 dragging : 1; /**< this is set true when an item is being dragged. this is set false on multidown/mouseup/mousedown. when this is true, the item should not be unrealized. or evas mouse down/up event will be corrupted. */
63    Eina_Bool                 down : 1;
64    Eina_Bool                 group : 1;
65    Eina_Bool                 reorder : 1;
66    Eina_Bool                 decorate_it_set : 1; /**< item uses style mode for highlight/select */
67    Eina_Bool                 flipped : 1; /**< a flag that shows the flip status of the item. */
68    Eina_Bool                 hide : 1;
69 };
70
71 typedef enum
72 {
73    ELM_GEN_ITEM_FX_TYPE_SAME,
74    ELM_GEN_ITEM_FX_TYPE_ADD,
75    ELM_GEN_ITEM_FX_TYPE_DEL,
76 } Elm_Gen_Item_Fx_Type;
77
78 typedef struct _Proxy_Item Proxy_Item;
79 struct _Proxy_Item
80 {
81    int                      num;
82    Elm_Gen_Item             *it;
83    Evas_Object              *proxy;
84    Evas_Coord                x, y, w, h;
85 };
86
87 typedef struct _Elm_Gen_FX_Item Elm_Gen_FX_Item;
88 struct _Elm_Gen_FX_Item
89 {
90    int                       num;
91    Elm_Gen_Item             *it;
92    Evas_Object              *proxy;
93    Elm_Gen_Item_Fx_Type      type;
94    Elm_Transit              *trans;
95
96    struct
97    {
98       Evas_Coord x, y, w, h;
99    } from;
100
101    struct
102    {
103       Evas_Coord x, y, w, h;
104    } to;
105
106    Eina_Bool update : 1;
107    Eina_Bool changed : 1;
108 };
109
110 typedef enum
111 {
112    ELM_GEN_PINCH_ZOOM_NONE = 0,
113    ELM_GEN_PINCH_ZOOM_CONTRACT = 1,
114    ELM_GEN_PINCH_ZOOM_EXPAND = 2
115 } Elm_Gen_Pinch_Zoom_Mode;
116
117 #endif