Merge remote-tracking branch 'remotes/origin/upstream'
[framework/uifw/elementary.git] / src / lib / elm_gen.h
1 <<<<<<< HEAD
2 #include <Elementary.h>
3 #include <Elementary_Cursor.h>
4 #include "elm_priv.h"
5
6 #define ELM_GEN_ITEM_FROM_INLIST(it) \
7    ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
8
9 typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type;
10 typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
11 typedef struct _Widget_Data Widget_Data;
12 typedef struct _Pan Pan;
13
14 struct Elm_Gen_Item_Tooltip
15 {
16    const void                 *data;
17    Elm_Tooltip_Item_Content_Cb content_cb;
18    Evas_Smart_Cb               del_cb;
19    const char                 *style;
20    Eina_Bool                   free_size : 1;
21 };
22
23 struct _Pan
24 {
25    Evas_Object_Smart_Clipped_Data __clipped_data;
26    Widget_Data                   *wd;
27    Ecore_Job                     *resize_job;
28 };
29
30 struct Elm_Gen_Item
31 {
32    ELM_WIDGET_ITEM;
33    EINA_INLIST;
34    Widget_Data                  *wd;
35    Elm_Gen_Item_Type            *item;
36    const Elm_Gen_Item_Class     *itc;
37    Evas_Coord                    x, y, dx, dy;
38    Evas_Object                  *spacer;
39    Elm_Gen_Item                 *parent;
40    Eina_List                    *labels, *contents, *states, *content_objs;
41    Ecore_Timer                  *long_timer;
42    int                           relcount;
43    int                           walking;
44    const char                   *mouse_cursor;
45
46    struct
47    {
48       Evas_Smart_Cb func;
49       const void   *data;
50    } func;
51
52    Elm_Gen_Item_Tooltip tooltip;
53    Ecore_Cb    del_cb, sel_cb, highlight_cb;
54    Ecore_Cb    unsel_cb, unhighlight_cb, unrealize_cb;
55
56    Eina_Bool   want_unrealize : 1;
57    Eina_Bool   display_only : 1;
58    Eina_Bool   realized : 1;
59    Eina_Bool   selected : 1;
60    Eina_Bool   highlighted : 1;
61    Eina_Bool   disabled : 1;
62    Eina_Bool   dragging : 1;
63    Eina_Bool   delete_me : 1;
64    Eina_Bool   down : 1;
65    Eina_Bool   group : 1;
66    Eina_Bool   reorder : 1;
67    Eina_Bool   mode_set : 1; /* item uses style mode for highlight/select */
68 };
69
70 Elm_Gen_Item *
71 elm_gen_item_new(Widget_Data              *wd,
72                  const Elm_Gen_Item_Class *itc,
73                  const void               *data,
74                  Elm_Gen_Item             *parent,
75                  Evas_Smart_Cb             func,
76                  const void               *func_data);
77
78 void
79 elm_gen_item_unrealize(Elm_Gen_Item *it,
80                        Eina_Bool     calc);
81 void
82 elm_gen_item_del_serious(Elm_Gen_Item *it);
83
84 void
85 elm_gen_item_del_notserious(Elm_Gen_Item *it);
86 =======
87 typedef struct Elm_Gen_Item             Elm_Gen_Item;
88
89 /**
90  * @struct Elm_Gen_Item_Class
91  *
92  * Gengrid or Genlist item class definition.
93  * field details.
94  */
95 typedef struct _Elm_Gen_Item_Class      Elm_Gen_Item_Class;
96
97 /**
98  * Text fetching class function for Elm_Gen_Item_Class.
99  * @param data The data passed in the item creation function
100  * @param obj The base widget object
101  * @param part The part name of the swallow
102  * @return The allocated (NOT stringshared) string to set as the text
103  */
104 typedef char                         *(*Elm_Gen_Item_Text_Get_Cb)(void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for gen item classes. */
105
106 /**
107  * Content (swallowed object) fetching class function for Elm_Gen_Item_Class.
108  * @param data The data passed in the item creation function
109  * @param obj The base widget object
110  * @param part The part name of the swallow
111  * @return The content object to swallow
112  */
113 typedef Evas_Object                  *(*Elm_Gen_Item_Content_Get_Cb)(void *data, Evas_Object *obj, const char *part); /**< Content(swallowed object) fetching class function for gen item classes. */
114
115 /**
116  * State fetching class function for Elm_Gen_Item_Class.
117  * @param data The data passed in the item creation function
118  * @param obj The base widget object
119  * @param part The part name of the swallow
120  * @return The hell if I know
121  */
122 typedef Eina_Bool                     (*Elm_Gen_Item_State_Get_Cb)(void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gen item classes. */
123
124 /**
125  * Deletion class function for Elm_Gen_Item_Class.
126  * @param data The data passed in the item creation function
127  * @param obj The base widget object
128  */
129 typedef void                          (*Elm_Gen_Item_Del_Cb)(void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */
130
131 struct _Elm_Gen_Item_Class
132 {
133    int           version;  /**< Set by elementary if you alloc an item class using elm_gengrid_item_class_new() or elm_genlist_item_class_new(), or if you set your own class (must be const) then set it to ELM_GENGRID_ITEM_CLASS_VERSION */
134    unsigned int  refcount; /**< Set it to 0 if you use your own const class, or its managed for you by class ref/unref calls */
135    Eina_Bool     delete_me : 1; /**< Leave this alone - set it to 0 if you have a const class of your own */
136    const char   *item_style; /**< Name of the visual style to use for this item. If you don't know use "default" */
137    const char   *mode_item_style; /**< Style used if item is set to a specific mode. @see elm_genlist_item_mode_set() or NULL if you don't care. currently it's used only in genlist. */
138    const char   *edit_item_style; /**< Style to use when in edit mode, or NULL if you don't care. currently it's used only in genlist. */
139    struct {
140       Elm_Gen_Item_Text_Get_Cb    text_get; /**< Text fetching class function for gengrid/list item classes.*/
141       Elm_Gen_Item_Content_Get_Cb content_get; /**< Content fetching class function for gengrid/list item classes. */
142       Elm_Gen_Item_State_Get_Cb   state_get; /**< State fetching class function for gengrid/list item classes. */
143       Elm_Gen_Item_Del_Cb         del; /**< Deletion class function for gengrid/list item classes. */
144    } func;
145 }; /**< #Elm_Gen_Item_Class member definitions */
146
147 #define ELM_GEN_ITEM_CLASS_VERSION 2
148 #define ELM_GEN_ITEM_CLASS_HEADER ELM_GEN_ITEM_CLASS_VERSION, 0, 0
149 >>>>>>> remotes/origin/upstream