Dear all
This patch introduces four new apis about elm_gen{list, grid} item
class managements.
itc_add function makes a new item_class for the given widget.
And itc_del function remove the item_class from the widget.
Most of elm_gen{list, grid} users declare itc(item_class) as a global variable.
Because itc should be lived at elm_gen{list,grid} item's life cycle.
It's inconvenient for users. Even some users pass itc.
itc_add makes a new itc. if exact one exists in the given widget, it
return the previous made itc.
itc_del remove a itc if its reference count reaches at zero.
Thanks.
EAPI Elm_Genlist_Item_Class *
elm_genlist_itc_add(Evas_Object *obj, const char *item_style,
Elm_Genlist_Item_Text_Get_Cb text_cb,
Elm_Genlist_Item_Content_Get_Cb content_cb,
Elm_Genlist_Item_State_Get_Cb state_cb,
Elm_Genlist_Item_Del_Cb del_cb);
EAPI void
elm_genlist_itc_del(Evas_Object *obj, Elm_Genlist_Item_Class *itc);
EAPI Elm_Gengrid_Item_Class *
elm_gengrid_itc_add(Evas_Object *obj, const char *item_style,
Elm_Gengrid_Item_Text_Get_Cb text_cb,
Elm_Gengrid_Item_Content_Get_Cb content_cb,
Elm_Gengrid_Item_State_Get_Cb state_cb,
Elm_Gengrid_Item_Del_Cb del_cb);
EAPI void
elm_gengrid_itc_del(Evas_Object *obj, Elm_Gengrid_Item_Class *itc);
Index: elementary/src/lib/elm_genlist.c
===================================================================
--- elementary/src/lib/elm_genlist.c (리비전 66928)
+++ elementary/src/lib/elm_genlist.c (작업 사본)
@@ -3254,12 +3254,16 @@
const void *func_data)
{
Elm_Gen_Item *it;
+ Elm_Genlist_Item_Class *newitc = NULL;
it = elm_widget_item_new(wd->obj, Elm_Gen_Item);
if (!it) return NULL;
it->wd = wd;
it->generation = wd->generation;
it->itc = itc;
+ newitc = eina_list_data_find(wd->itcs, itc);
+ if (newitc) newitc->refcount++;
+
it->base.data = data;
it->parent = parent;
it->func.func = func;
@@ -4013,6 +4017,8 @@
_elm_genlist_clear(Evas_Object *obj, Eina_Bool standby)
{
Eina_Inlist *next, *l;
+ Eina_List *li;
+ Elm_Genlist_Item_Class *itc;
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
@@ -4048,6 +4054,12 @@
if (itn) itn->walking--;
}
}
+ EINA_LIST_FOREACH(wd->itcs, li, itc)
+ {
+ wd->itcs = eina_list_remove(wd->itcs, itc);
+ free((char*)itc->item_style);
+ free(itc);
+ }
wd->clear_me = 0;
wd->pan_changed = EINA_TRUE;
if (wd->calc_job)
@@ -5237,6 +5249,64 @@
return wd->reorder_mode;
}
+EAPI Elm_Genlist_Item_Class *
+elm_genlist_itc_add(Evas_Object *obj, const char *item_style,
+ Elm_Genlist_Item_Text_Get_Cb text_cb,
+ Elm_Genlist_Item_Content_Get_Cb content_cb,
+ Elm_Genlist_Item_State_Get_Cb state_cb,
+ Elm_Genlist_Item_Del_Cb del_cb)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_List *l;
+ Elm_Genlist_Item_Class *itc;
+
+ EINA_LIST_FOREACH(wd->itcs, l, itc)
+ {
+ if (!strcmp(item_style, itc->item_style))
+ {
+ if ((text_cb == itc->func.text_get) &&
+ (content_cb == itc->func.content_get) &&
+ (state_cb == itc->func.state_get) &&
+ (del_cb == itc->func.del))
+ {
+ return itc;
+ }
+ }
+ }
+
+ itc = calloc(1, sizeof(Elm_Genlist_Item_Class));
+ wd->itcs = eina_list_append(wd->itcs, itc);
+
+ itc->item_style = strdup(item_style);
+ itc->func.text_get = text_cb;
+ itc->func.content_get = content_cb;
+ itc->func.state_get = state_cb;
+ itc->func.del = del_cb;
+ itc->refcount = 0;
+
+ return itc;
+}
+
+EAPI void
+elm_genlist_itc_del(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ Elm_Genlist_Item_Class *delitc = NULL;
+
+ delitc = eina_list_data_find(wd->itcs, itc);
+ if (delitc && (!delitc->refcount))
+ {
+ wd->itcs = eina_list_remove(wd->itcs, delitc);
+ free((char*)delitc->item_style);
+ free(delitc);
+ }
+}
+
/* for gengrid as of now */
void
_elm_genlist_page_relative_set(Evas_Object *obj,
@@ -5393,6 +5463,8 @@
void
_elm_genlist_item_del_serious(Elm_Gen_Item *it)
{
+ Elm_Genlist_Item_Class *newitc = NULL;
+
_elm_genlist_item_del_notserious(it);
it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
if (it->tooltip.del_cb)
@@ -5407,4 +5479,7 @@
free(it->item);
it->item = NULL;
elm_widget_item_del(it);
+
+ newitc = eina_list_data_find(it->wd->itcs, it->itc);
+ if (newitc) newitc->refcount--;
}
Index: elementary/src/lib/elm_genlist.h
===================================================================
--- elementary/src/lib/elm_genlist.h (리비전 66928)
+++ elementary/src/lib/elm_genlist.h (작업 사본)
@@ -409,6 +409,7 @@
Elm_Genlist_Item_State_Get_Cb state_get; /**< State fetching class
function for genlist item classes. */
Elm_Genlist_Item_Del_Cb del; /**< Deletion class function for
genlist item classes. */
} func;
+ unsigned int refcount;
};
#define Elm_Genlist_Item_Class_Func Elm_Gen_Item_Class_Func
/**
@@ -1909,5 +1910,55 @@
EAPI Eina_Bool elm_genlist_reorder_mode_get(const
Evas_Object *obj);
/**
+ * Add a new genlist item class in a given genlist widget.
+ *
+ * @param obj The genlist object
+ * @param item_style The item class style name
+ * @param text_cb The text retrieving callback function ptr
+ * @param content_cb The content retrieving callback function ptr
+ * @param state_cb The state change callback function ptr
+ * @param del_cb The delete callback function ptr
+ * @return New allocated a genlist item class or return exist itc.
+ *
+ * This adds genlist item class for the genlist widget. When adding a item,
+ * genlist_item_{append, prepend, insert} function needs item class of the
item.
+ * Given callback paramters are used at retrieving {text, content} of
+ * added item. Set as NULL if it's not used.
+ * If there's no available memory, return can be NULL.
+ *
+ * @see elm_genlist_itc_del()
+ * @see elm_genlist_item_append()
+ *
+ * @ingroup Genlist
+ */
+
+
+EAPI Elm_Genlist_Item_Class *
+elm_genlist_itc_add(Evas_Object *obj, const char *item_style,
+ Elm_Genlist_Item_Text_Get_Cb text_cb,
+ Elm_Genlist_Item_Content_Get_Cb content_cb,
+ Elm_Genlist_Item_State_Get_Cb state_cb,
+ Elm_Genlist_Item_Del_Cb del_cb);
+
+/**
+ * Remove a item class in a given genlist widget.
+ *
+ * @param obj The genlist object
+ * @param itc The itc to be removed.
+ *
+ * This removes item class from the genlist widget.
+ * the item class structure contains its reference count.
+ * If it's used, item class is going to be freed.
+ *
+ * @see elm_genlist_itc_add()
+ *
+ * @ingroup Genlist
+ */
+
+EAPI void
+elm_genlist_itc_del(Evas_Object *obj, Elm_Genlist_Item_Class *itc);
+
+
+/**
* @}
*/
Index: elementary/src/lib/elm_gen_common.h
===================================================================
--- elementary/src/lib/elm_gen_common.h (리비전 66928)
+++ elementary/src/lib/elm_gen_common.h (작업 사본)
@@ -90,6 +90,7 @@
Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart
object. this is an extern pan of smart scroller(scr). */
Eina_List *selected;
Eina_List *group_items; /* list of groups index items */
+ Eina_List *itcs; /* list of item classes */
Eina_Inlist *items; /* inlist of all items */
Elm_Gen_Item *reorder_it; /* item currently being
repositioned */
Elm_Gen_Item *last_selected_item;
Index: elementary/src/lib/elm_gengrid.c
===================================================================
--- elementary/src/lib/elm_gengrid.c (리비전 66928)
+++ elementary/src/lib/elm_gengrid.c (작업 사본)
@@ -2746,3 +2746,60 @@
return wd->filled;
}
+EAPI Elm_Gengrid_Item_Class *
+elm_gengrid_itc_add(Evas_Object *obj, const char *item_style,
+ Elm_Gengrid_Item_Text_Get_Cb text_cb,
+ Elm_Gengrid_Item_Content_Get_Cb content_cb,
+ Elm_Gengrid_Item_State_Get_Cb state_cb,
+ Elm_Gengrid_Item_Del_Cb del_cb)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_List *l;
+ Elm_Gengrid_Item_Class *itc;
+
+ EINA_LIST_FOREACH(wd->itcs, l, itc)
+ {
+ if (!strcmp(item_style, itc->item_style))
+ {
+ if ((text_cb == itc->func.text_get) &&
+ (content_cb == itc->func.content_get) &&
+ (state_cb == itc->func.state_get) &&
+ (del_cb == itc->func.del))
+ {
+ return itc;
+ }
+ }
+ }
+
+ itc = calloc(1, sizeof(Elm_Gengrid_Item_Class));
+ wd->itcs = eina_list_append(wd->itcs, itc);
+
+ itc->item_style = strdup(item_style);
+ itc->func.text_get = text_cb;
+ itc->func.content_get = content_cb;
+ itc->func.state_get = state_cb;
+ itc->func.del = del_cb;
+ itc->refcount = 0;
+
+ return itc;
+}
+
+EAPI void
+elm_gengrid_itc_del(Evas_Object *obj, Elm_Gengrid_Item_Class *itc)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ Elm_Gengrid_Item_Class *delitc = NULL;
+
+ delitc = eina_list_data_find(wd->itcs, itc);
+ if (delitc && (!delitc->refcount))
+ {
+ wd->itcs = eina_list_remove(wd->itcs, delitc);
+ free((char*)delitc->item_style);
+ free(delitc);
+ }
+}
Index: elementary/src/lib/elm_gengrid.h
===================================================================
--- elementary/src/lib/elm_gengrid.h (리비전 66928)
+++ elementary/src/lib/elm_gengrid.h (작업 사본)
@@ -266,6 +266,7 @@
Elm_Gengrid_Item_State_Get_Cb state_get; /**< State fetching class
function for gengrid item classes. */
Elm_Gengrid_Item_Del_Cb del; /**< Deletion class function for
gengrid item classes. */
} func;
+ unsigned int refcount;
}; /**< #Elm_Gengrid_Item_Class member definitions */
#define Elm_Gengrid_Item_Class_Func Elm_Gen_Item_Class_Func
@@ -1550,5 +1551,54 @@
EAPI Eina_Bool elm_gengrid_filled_get(const Evas_Object
*obj);
/**
+ * Add a new gengrid item class in a given gengrid widget.
+ *
+ * @param obj The gengrid object
+ * @param item_style The item class style name
+ * @param text_cb The text retrieving callback function ptr
+ * @param content_cb The content retrieving callback function ptr
+ * @param state_cb The state change callback function ptr
+ * @param del_cb The delete callback function ptr
+ * @return New allocated a gengrid item class or return exist itc.
+ *
+ * This adds gengrid item class for the gengrid widget. When adding a item,
+ * gengrid_item_{append, prepend, insert} function needs item class of the
item.
+ * Given callback paramters are used at retrieving {text, content} of
+ * added item. Set as NULL if it's not used.
+ * If there's no available memory, return can be NULL.
+ *
+ * @see elm_gengrid_itc_del()
+ * @see elm_gengrid_item_append()
+ *
+ * @ingroup Gengrid
+ */
+
+EAPI Elm_Gengrid_Item_Class *
+elm_gengrid_itc_add(Evas_Object *obj, const char *item_style,
+ Elm_Gengrid_Item_Text_Get_Cb text_cb,
+ Elm_Gengrid_Item_Content_Get_Cb content_cb,
+ Elm_Gengrid_Item_State_Get_Cb state_cb,
+ Elm_Gengrid_Item_Del_Cb del_cb);
+
+/**
+ * Remove a item class in a given gengrid widget.
+ *
+ * @param obj The gengrid object
+ * @param itc The itc to be removed.
+ *
+ * This removes item class from the genlist widget.
+ * the item class structure contains its reference count.
+ * If it's used, item class is going to be freed.
+ *
+ * @see elm_gengrid_itc_add()
+ *
+ * @ingroup Gengrid
+ */
+
+EAPI void
+elm_gengrid_itc_del(Evas_Object *obj, Elm_Gengrid_Item_Class *itc);
+
+
+/**
* @}
*/
Index: elementary/src/lib/elm_deprecated_before.h
===================================================================
--- elementary/src/lib/elm_deprecated_before.h (리비전 66928)
+++ elementary/src/lib/elm_deprecated_before.h (작업 사본)
@@ -17,4 +17,5 @@
Elm_Gen_Item_State_Get_Cb state_get;
Elm_Gen_Item_Del_Cb del;
} func;
+ unsigned int refcount;
};
Index: elementary/src/bin/test_genlist.c
===================================================================
--- elementary/src/bin/test_genlist.c (리비전 66928)
+++ elementary/src/bin/test_genlist.c (작업 사본)
@@ -20,7 +20,7 @@
} Testitem;
-static Elm_Genlist_Item_Class itc1;
+static Elm_Genlist_Item_Class *itc1;
char *gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part
__UNUSED__)
{
char buf[256];
@@ -140,11 +140,8 @@
evas_object_size_hint_weight_set(over, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, over);
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
bt_50 = elm_button_add(win);
elm_object_text_set(bt_50, "Go to 50");
@@ -158,7 +155,7 @@
for (i = 0; i < 2000; i++)
{
- gli = elm_genlist_item_append(gl, &itc1,
+ gli = elm_genlist_item_append(gl, itc1,
(void *)(long)i/* item data */,
NULL/* parent */,
ELM_GENLIST_ITEM_NONE,
@@ -188,13 +185,10 @@
Evas_Object *gl = data;
static int i = 0;
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)(long)i/* item data */,
NULL/* parent */,
ELM_GENLIST_ITEM_NONE,
@@ -210,11 +204,8 @@
static int i = 0;
Elm_Genlist_Item *gli_selected;
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
gli_selected = elm_genlist_selected_item_get(gl);
if(!gli_selected)
@@ -223,7 +214,7 @@
return ;
}
- elm_genlist_item_insert_before(gl, &itc1,
+ elm_genlist_item_insert_before(gl, itc1,
(void *)(long)i/* item data */,
NULL/* parent */,
gli_selected /* item before */,
@@ -240,11 +231,8 @@
static int i = 0;
Elm_Genlist_Item *gli_selected;
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
gli_selected = elm_genlist_selected_item_get(gl);
if(!gli_selected)
@@ -253,7 +241,7 @@
return ;
}
- elm_genlist_item_insert_after(gl, &itc1,
+ elm_genlist_item_insert_after(gl, itc1,
(void *)(long)i/* item data */,
NULL/* parent */,
gli_selected /* item after */,
@@ -367,31 +355,28 @@
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(gl);
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
- gli[0] = elm_genlist_item_append(gl, &itc1,
+ gli[0] = elm_genlist_item_append(gl, itc1,
(void *)1001/* item data */, NULL/* parent
*/, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
(void *)1001/* func data */);
- gli[1] = elm_genlist_item_append(gl, &itc1,
+ gli[1] = elm_genlist_item_append(gl, itc1,
(void *)1002/* item data */, NULL/* parent
*/, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
(void *)1002/* func data */);
- gli[2] = elm_genlist_item_append(gl, &itc1,
+ gli[2] = elm_genlist_item_append(gl, itc1,
(void *)1003/* item data */, NULL/* parent
*/, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
(void *)1003/* func data */);
- gli[3] = elm_genlist_item_prepend(gl, &itc1,
+ gli[3] = elm_genlist_item_prepend(gl, itc1,
(void *)1004/* item data */, NULL/*
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
(void *)1004/* func data */);
- gli[4] = elm_genlist_item_prepend(gl, &itc1,
+ gli[4] = elm_genlist_item_prepend(gl, itc1,
(void *)1005/* item data */, NULL/*
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
(void *)1005/* func data */);
- gli[5] = elm_genlist_item_insert_before(gl, &itc1,
+ gli[5] = elm_genlist_item_insert_before(gl, itc1,
(void *)1006/* item data */, NULL/*
parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
gl_sel/* func */, (void *)1006/*
func data */);
- gli[6] = elm_genlist_item_insert_after(gl, &itc1,
+ gli[6] = elm_genlist_item_insert_after(gl, itc1,
(void *)1007/* item data */, NULL/*
parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE,
gl_sel/* func */, (void *)1007/*
func data */);
@@ -677,7 +662,6 @@
printf("item %p onoff = %i\n", tit, tit->onoff);
}
-static Elm_Genlist_Item_Class itc3;
char *gl3_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part
__UNUSED__)
{
const Testitem *tit = data;
@@ -722,6 +706,7 @@
{
Evas_Object *win, *bg, *gl, *bx, *bx2, *bt;
static Testitem tit[3];
+ Elm_Genlist_Item_Class *itc3;
win = elm_win_add(NULL, "genlist4", ELM_WIN_BASIC);
elm_win_title_set(win, "Genlist 4");
@@ -744,22 +729,19 @@
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(gl);
- itc3.item_style = "default";
- itc3.func.text_get = gl3_text_get;
- itc3.func.content_get = gl3_content_get;
- itc3.func.state_get = gl3_state_get;
- itc3.func.del = gl3_del;
+ itc3 = elm_genlist_itc_add(gl, "default", gl3_text_get, gl3_content_get,
+ gl3_state_get, gl3_del);
tit[0].mode = 0;
- tit[0].item = elm_genlist_item_append(gl, &itc3,
+ tit[0].item = elm_genlist_item_append(gl, itc3,
&(tit[0])/* item data */, NULL/*
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
NULL/* func data */);
tit[1].mode = 1;
- tit[1].item = elm_genlist_item_append(gl, &itc3,
+ tit[1].item = elm_genlist_item_append(gl, itc3,
&(tit[1])/* item data */, NULL/*
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
NULL/* func data */);
tit[2].mode = 2;
- tit[2].item = elm_genlist_item_append(gl, &itc3,
+ tit[2].item = elm_genlist_item_append(gl, itc3,
&(tit[2])/* item data */, NULL/*
parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */,
NULL/* func data */);
@@ -1389,11 +1371,8 @@
elm_box_pack_end(bx, gl);
evas_object_show(gl);
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
itc_group.item_style = "group_index";
itc_group.func.text_get = gl8_text_get;
@@ -1490,7 +1469,7 @@
}
else if (git)
{
- gli = elm_genlist_item_append(gl, &itc1,
+ gli = elm_genlist_item_append(gl, itc1,
(void *)(long)i/* item data */,
git/* parent */,
ELM_GENLIST_ITEM_NONE,
@@ -1537,15 +1516,15 @@
Evas_Object *gl = elm_genlist_item_genlist_get(it);
int val = (int)(long)elm_genlist_item_data_get(it);
val *= 10;
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)(long)(val + 1)/* item data */, it/* parent
*/,
ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)(long)(val + 2)/* item data */, it/* parent
*/,
ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)(long)(val + 3)/* item data */, it/* parent
*/,
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
@@ -1599,11 +1578,8 @@
elm_box_pack_end(bx, gl);
evas_object_show(gl);
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
itc_group.item_style = "group_index";
itc_group.func.text_get = gl8_text_get;
@@ -1615,26 +1591,26 @@
(void *)0/* item data */, NULL/* parent */,
ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
NULL/* func data */);
elm_genlist_item_display_only_set(git, EINA_TRUE);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)1/* item data */, git/* parent */,
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)2/* item data */, git/* parent */,
ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)3/* item data */, git/* parent */,
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
git = elm_genlist_item_append(gl, &itc_group,
(void *)4/* item data */, NULL/* parent */,
ELM_GENLIST_ITEM_GROUP, gl4_sel/* func */,
NULL/* func data */);
elm_genlist_item_display_only_set(git, EINA_TRUE);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)5/* item data */, git/* parent */,
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)6/* item data */, git/* parent */,
ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)7/* item data */, git/* parent */,
ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
NULL/* func data */);
@@ -1872,16 +1848,13 @@
elm_box_pack_end(bx, tg);
evas_object_show(tg);
- itc1.item_style = "default";
- itc1.func.text_get = gl_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "default", gl_text_get, gl_content_get,
+ gl_state_get, gl_del);
evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl);
for (i = 0; i < 50; i++)
elm_genlist_item_append(gl,
- &itc1,
+ itc1,
(void *)(1 + i)/* item data */,
NULL/* parent */,
ELM_GENLIST_ITEM_NONE/* flags */,
@@ -1926,15 +1899,12 @@
elm_box_pack_end(bx, gl);
evas_object_show(gl);
- itc1.item_style = "message";
- itc1.func.text_get = gl12_text_get;
- itc1.func.content_get = gl_content_get;
- itc1.func.state_get = gl_state_get;
- itc1.func.del = gl_del;
+ itc1 = elm_genlist_itc_add(gl, "message", gl12_text_get, gl_content_get,
+ gl_state_get, gl_del);
for (i = 0; i < 1000; i++)
{
- elm_genlist_item_append(gl, &itc1,
+ elm_genlist_item_append(gl, itc1,
(void *)(long)i/* item data */,
NULL/* parent */,
ELM_GENLIST_ITEM_NONE,
Index: elementary/src/bin/test_gengrid.c
===================================================================
--- elementary/src/bin/test_gengrid.c (리비전 66928)
+++ elementary/src/bin/test_gengrid.c (작업 사본)
@@ -24,7 +24,7 @@
"wood_01.jpg",
};
-static Elm_Gengrid_Item_Class gic, ggic;
+static Elm_Gengrid_Item_Class *gic;
static void
_horizontal_grid(void *data, Evas_Object *obj, void *event_info __UNUSED__)
@@ -180,11 +180,8 @@
evas_object_smart_callback_add(grid, "drag,stop", grid_drag_stop, NULL);
evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- gic.item_style = "default";
- gic.func.text_get = grid_text_get;
- gic.func.content_get = grid_content_get;
- gic.func.state_get = grid_state_get;
- gic.func.del = grid_del;
+ gic = elm_gengrid_itc_add(grid, "default", grid_text_get,
+ grid_content_get, grid_state_get, grid_del);
n = 0;
for (i = 0; i < 12 * 12; i++)
@@ -193,7 +190,7 @@
n = (n + 1) % 9;
ti[i].mode = i;
ti[i].path = eina_stringshare_add(buf);
- ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), grid_sel,
NULL);
+ ti[i].item = elm_gengrid_item_append(grid, gic, &(ti[i]), grid_sel,
NULL);
if (!(i % 5))
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
}
@@ -220,7 +217,7 @@
ti = malloc(sizeof(*ti));
ti->mode = 0;
ti->path = eina_stringshare_add(buf);
- ti->item = elm_gengrid_item_insert_before(grid, &gic, ti, sel, grid_sel,
+ ti->item = elm_gengrid_item_insert_before(grid, gic, ti, sel, grid_sel,
NULL);
}
@@ -239,7 +236,7 @@
ti = malloc(sizeof(*ti));
ti->mode = 0;
ti->path = eina_stringshare_add(buf);
- ti->item = elm_gengrid_item_insert_after(grid, &gic, ti, sel, grid_sel,
+ ti->item = elm_gengrid_item_insert_after(grid, gic, ti, sel, grid_sel,
NULL);
}
@@ -267,7 +264,7 @@
ti = malloc(sizeof(*ti));
ti->mode = 0;
ti->path = eina_stringshare_add(buf);
- ti->item = elm_gengrid_item_prepend(grid, &gic, ti, grid_sel, NULL);
+ ti->item = elm_gengrid_item_prepend(grid, gic, ti, grid_sel, NULL);
}
static void
@@ -281,7 +278,7 @@
ti = malloc(sizeof(*ti));
ti->mode = 0;
ti->path = eina_stringshare_add(buf);
- ti->item = elm_gengrid_item_append(grid, &gic, ti, grid_sel, NULL);
+ ti->item = elm_gengrid_item_append(grid, gic, ti, grid_sel, NULL);
}
static void
@@ -372,11 +369,8 @@
elm_box_pack_end(hbx, ck);
evas_object_show(ck);
- gic.item_style = "default";
- gic.func.text_get = grid_text_get;
- gic.func.content_get = grid_content_get;
- gic.func.state_get = grid_state_get;
- gic.func.del = grid_del;
+ gic = elm_gengrid_itc_add(grid, "default", grid_text_get,
+ grid_content_get, grid_state_get, grid_del);
evas_object_resize(win, 600, 600);
evas_object_show(win);
@@ -386,6 +380,7 @@
test_gengrid3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void
*event_info __UNUSED__)
{
Evas_Object *win, *bg, *grid;
+ Elm_Gengrid_Item_Class *ggic;
static Testitem ti[144];
int i, n;
char buf[PATH_MAX];
@@ -417,17 +412,11 @@
evas_object_smart_callback_add(grid, "drag,stop", grid_drag_stop, NULL);
evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- gic.item_style = "default";
- gic.func.text_get = grid_text_get;
- gic.func.content_get = grid_content_get;
- gic.func.state_get = grid_state_get;
- gic.func.del = grid_del;
+ gic = elm_gengrid_itc_add(grid, "default", grid_text_get,
+ grid_content_get, grid_state_get, grid_del);
- ggic.item_style = "group_index";
- ggic.func.text_get = grid_text_get;
- ggic.func.content_get = NULL;
- ggic.func.state_get = NULL;
- ggic.func.del = NULL;
+ ggic = elm_gengrid_itc_add(grid, "group_index", grid_text_get,
+ NULL, NULL, NULL);
n = 0;
@@ -439,9 +428,9 @@
ti[i].path = eina_stringshare_add(buf);
if (i == 0 || i == 18 || i == 53 || i == 100)
//if (i == 0 || i == 18)
- ti[i].item = elm_gengrid_item_append(grid, &ggic, &(ti[i]),
grid_sel, NULL);
+ ti[i].item = elm_gengrid_item_append(grid, ggic, &(ti[i]), grid_sel,
NULL);
else
- ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), grid_sel,
NULL);
+ ti[i].item = elm_gengrid_item_append(grid, gic, &(ti[i]), grid_sel,
NULL);
if (!(i % 5))
elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
}
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel