"wood_01.jpg",
};
-static Elm_Gengrid_Item_Class gic;
-Evas_Object *before_bt, *after_bt;
+static Elm_Gengrid_Item_Class *gic = NULL;
+static Evas_Object *before_bt, *after_bt;
static void
_on_done(void *data __UNUSED__,
return;
it = _item_new();
- elm_gengrid_item_insert_before(grid, &gic, it, sel, _grid_sel, NULL);
+ elm_gengrid_item_insert_before(grid, gic, it, sel, _grid_sel, NULL);
}
/* "insert after" callback */
return;
it = _item_new();
- elm_gengrid_item_insert_after(grid, &gic, it, sel, _grid_sel, NULL);
+ elm_gengrid_item_insert_after(grid, gic, it, sel, _grid_sel, NULL);
}
/* prepend an item */
Evas_Object *grid = data;
it = _item_new();
- elm_gengrid_item_prepend(grid, &gic, it, _grid_sel, NULL);
+ elm_gengrid_item_prepend(grid, gic, it, _grid_sel, NULL);
}
/* append an item */
Evas_Object *grid = data;
Example_Item *it = _item_new();
- elm_gengrid_item_append(grid, &gic, it, _grid_sel, NULL);
+ elm_gengrid_item_append(grid, gic, it, _grid_sel, NULL);
}
/* delete items */
_page_change_cb(grid, sl, NULL);
evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid);
- gic.item_style = "default";
- gic.func.text_get = _grid_label_get;
- gic.func.content_get = _grid_content_get;
- gic.func.state_get = _grid_state_get;
- gic.func.del = _grid_del;
+ if (!gic)
+ {
+ gic = elm_gengrid_item_class_new();
+ gic->item_style = "default";
+ gic->func.text_get = _grid_label_get;
+ gic->func.content_get = _grid_content_get;
+ gic->func.state_get = _grid_state_get;
+ gic->func.del = _grid_del;
+ } // we only create the first time its needed. we dont unref/free
_append_bt_clicked(grid, NULL, NULL);
_append_bt_clicked(grid, NULL, NULL);
#define N_ITEMS 30
-static Elm_Genlist_Item_Class _itc;
+static Elm_Genlist_Item_Class *_itc = NULL;
static char *
_item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
- _itc.item_style = "default";
- _itc.func.text_get = _item_label_get;
- _itc.func.content_get = _item_content_get;
- _itc.func.state_get = NULL;
- _itc.func.del = NULL;
+ if (!_itc)
+ {
+ _itc = elm_genlist_item_class_new();
+ _itc->item_style = "default";
+ _itc->func.text_get = _item_label_get;
+ _itc->func.content_get = _item_content_get;
+ _itc->func.state_get = NULL;
+ _itc->func.del = NULL;
+ }
list = elm_genlist_add(win);
for (i = 0; i < N_ITEMS; i++)
{
- elm_genlist_item_append(list, &_itc,
+ elm_genlist_item_append(list, _itc,
(void *)(long)i, NULL,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
#define N_ITEMS 300
-static Elm_Genlist_Item_Class _itc;
+static Elm_Genlist_Item_Class *_itc = NULL;
static char *
_item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
list = elm_genlist_add(win);
- _itc.item_style = "default";
- _itc.func.text_get = _item_label_get;
- _itc.func.content_get = _item_content_get;
- _itc.func.state_get = NULL;
- _itc.func.del = NULL;
+ if (!_itc)
+ {
+ _itc = elm_genlist_item_class_new();
+ _itc->item_style = "default";
+ _itc->func.text_get = _item_label_get;
+ _itc->func.content_get = _item_content_get;
+ _itc->func.state_get = NULL;
+ _itc->func.del = NULL;
+ }
Eina_Bool hbounce, vbounce;
Elm_Scroller_Policy hp, vp;
for (i = 0; i < N_ITEMS; i++)
{
- elm_genlist_item_append(list, &_itc,
+ elm_genlist_item_append(list, _itc,
(void *)(long)i, NULL,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
#define N_ITEMS 30
-static Elm_Genlist_Item_Class _itc;
+static Elm_Genlist_Item_Class *_itc = NULL;
static char *
_item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
for (i = 0; i < N_ITEMS; i++)
{
- elm_genlist_item_append(list, &_itc,
+ elm_genlist_item_append(list, _itc,
(void *)(long)i, NULL,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
elm_win_resize_object_add(win, box);
evas_object_show(box);
- _itc.item_style = "double_label";
- _itc.func.text_get = _item_label_get;
- _itc.func.content_get = _item_content_get;
- _itc.func.state_get = NULL;
- _itc.func.del = NULL;
-
+ if (!_itc)
+ {
+ _itc = elm_genlist_item_class_new();
+ _itc->item_style = "double_label";
+ _itc->func.text_get = _item_label_get;
+ _itc->func.content_get = _item_content_get;
+ _itc->func.state_get = NULL;
+ _itc->func.del = NULL;
+ }
+
list = _genlist_add(box);
_genlist_fill(list);
#define N_ITEMS 300
-static Elm_Genlist_Item_Class _itc;
-static Elm_Genlist_Item_Class _itc_group;
+static Elm_Genlist_Item_Class *_itc = NULL;
+static Elm_Genlist_Item_Class *_itc_group = NULL;
static int nitems = 0;
static char *
{
Evas_Object *list = data;
- elm_genlist_item_append(list, &_itc,
+ elm_genlist_item_append(list, _itc,
(void *)(long)nitems++, NULL,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
{
Evas_Object *list = data;
- elm_genlist_item_prepend(list, &_itc,
+ elm_genlist_item_prepend(list, _itc,
(void *)(long)nitems++, NULL,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
if (!glit) return;
- elm_genlist_item_insert_before(list, &_itc,
+ elm_genlist_item_insert_before(list, _itc,
(void *)(long)nitems++, NULL,
glit, ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
if (!glit) return;
- elm_genlist_item_insert_after(list, &_itc,
+ elm_genlist_item_insert_after(list, _itc,
(void *)(long)nitems++, NULL,
glit, ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
elm_win_resize_object_add(win, box);
evas_object_show(box);
- _itc.item_style = "double_label";
- _itc.func.text_get = _item_label_get;
- _itc.func.content_get = _item_content_get;
- _itc.func.state_get = NULL;
- _itc.func.del = NULL;
-
- _itc_group.item_style = "group_index";
- _itc_group.func.text_get = _group_label_get;
- _itc_group.func.content_get = _group_content_get;
- _itc_group.func.state_get = NULL;
- _itc_group.func.del = NULL;
+ if (!_itc)
+ {
+ _itc = elm_genlist_item_class_new();
+ _itc->item_style = "default";
+ _itc->func.text_get = _item_label_get;
+ _itc->func.content_get = _item_content_get;
+ _itc->func.state_get = NULL;
+ _itc->func.del = NULL;
+ }
+ if (!_itc_group)
+ {
+ _itc_group = elm_genlist_item_class_new();
+ _itc_group->item_style = "default";
+ _itc_group->func.text_get = _item_label_get;
+ _itc_group->func.content_get = _item_content_get;
+ _itc_group->func.state_get = NULL;
+ _itc_group->func.del = NULL;
+ }
+
list = elm_genlist_add(win);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
if (i % 7 == 0)
{
- glg = gli = elm_genlist_item_append(list, &_itc_group,
+ glg = gli = elm_genlist_item_append(list, _itc_group,
(void *)(long)nitems++, NULL,
ELM_GENLIST_ITEM_GROUP,
_item_sel_cb, NULL);
}
else
{
- gli = elm_genlist_item_append(list, &_itc,
+ gli = elm_genlist_item_append(list, _itc,
(void *)(long)nitems++, glg,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
Eina_Bool favorite;
} Node_Data;
-static Elm_Genlist_Item_Class _itc;
-static Elm_Genlist_Item_Class _itp;
-static Elm_Genlist_Item_Class _itfav;
+static Elm_Genlist_Item_Class *_itc = NULL;
+static Elm_Genlist_Item_Class *_itp = NULL;
+static Elm_Genlist_Item_Class *_itfav = NULL;
static int nitems = 0;
static char *
else
d->level = 0;
- elm_genlist_item_append(list, &_itc,
+ elm_genlist_item_append(list, _itc,
d, parent,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
Node_Data *d = elm_object_item_data_get(glit);
d->favorite = !d->favorite;
if (d->favorite)
- elm_genlist_item_item_class_update(glit, &_itfav);
+ elm_genlist_item_item_class_update(glit, _itfav);
else
{
if (d->children)
- elm_genlist_item_item_class_update(glit, &_itp);
+ elm_genlist_item_item_class_update(glit, _itp);
else
- elm_genlist_item_item_class_update(glit, &_itc);
+ elm_genlist_item_item_class_update(glit, _itc);
}
elm_genlist_item_update(glit);
elm_object_item_del(glit);
if (glit_prev != glit_parent)
- glit = elm_genlist_item_insert_after(list, &_itp, d, glit_parent,
+ glit = elm_genlist_item_insert_after(list, _itp, d, glit_parent,
glit_prev,
ELM_GENLIST_ITEM_SUBITEMS,
_item_sel_cb, NULL);
else
- glit = elm_genlist_item_prepend(list, &_itp, d, glit_parent,
+ glit = elm_genlist_item_prepend(list, _itp, d, glit_parent,
ELM_GENLIST_ITEM_SUBITEMS,
_item_sel_cb, NULL);
elm_genlist_item_expanded_set(glit, EINA_FALSE);
}
else if (elm_genlist_item_expanded_get(glit))
{
- elm_genlist_item_append(list, &_itc, ndata, glit,
+ elm_genlist_item_append(list, _itc, ndata, glit,
ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL);
}
Elm_Genlist_Item_Type type = ELM_GENLIST_ITEM_NONE;
printf("expanding item: #%d from parent #%d\n", it_data->value, d->value);
if (it_data->favorite)
- ic = &_itfav;
+ ic = _itfav;
else if (it_data->children)
{
- ic = &_itp;
+ ic = _itp;
type = ELM_GENLIST_ITEM_SUBITEMS;
}
else
- ic = &_itc;
+ ic = _itc;
nitem = elm_genlist_item_append(list, ic, it_data, glit,
type, _item_sel_cb, NULL);
elm_win_resize_object_add(win, box);
evas_object_show(box);
- _itc.item_style = "default";
- _itc.func.text_get = _item_label_get;
- _itc.func.content_get = _item_content_get;
- _itc.func.state_get = NULL;
- _itc.func.del = NULL;
-
- _itp.item_style = "default";
- _itp.func.text_get = _parent_label_get;
- _itp.func.content_get = _parent_content_get;
- _itp.func.state_get = NULL;
- _itp.func.del = NULL;
-
- _itfav.item_style = "default";
- _itfav.func.text_get = _favorite_label_get;
- _itfav.func.content_get = _favorite_content_get;
- _itfav.func.state_get = NULL;
- _itfav.func.del = NULL;
+ if (!_itc)
+ {
+ _itc = elm_genlist_item_class_new();
+ _itc->item_style = "default";
+ _itc->func.text_get = _item_label_get;
+ _itc->func.content_get = _item_content_get;
+ _itc->func.state_get = NULL;
+ _itc->func.del = NULL;
+ }
+
+ if (!_itp)
+ {
+ _itp = elm_genlist_item_class_new();
+ _itp->item_style = "default";
+ _itp->func.text_get = _parent_label_get;
+ _itp->func.content_get = _parent_content_get;
+ _itp->func.state_get = NULL;
+ _itp->func.del = NULL;
+ }
+
+ if (!_itfav)
+ {
+ _itfav = elm_genlist_item_class_new();
+ _itfav->item_style = "default";
+ _itfav->func.text_get = _favorite_label_get;
+ _itfav->func.content_get = _favorite_content_get;
+ _itfav->func.state_get = NULL;
+ _itfav->func.del = NULL;
+ }
list = elm_genlist_add(win);
printf("creating item: #%d\n", data->value);
if (i % 3 == 0)
{
- glg = gli = elm_genlist_item_append(list, &_itp, data, NULL,
+ glg = gli = elm_genlist_item_append(list, _itp, data, NULL,
ELM_GENLIST_ITEM_SUBITEMS,
_item_sel_cb, NULL);
elm_genlist_item_expanded_set(glg, EINA_TRUE);
}
else
{
- gli = elm_genlist_item_append(list, &_itc, data, glg,
+ gli = elm_genlist_item_append(list, _itc, data, glg,
ELM_GENLIST_ITEM_NONE,
_item_sel_cb, NULL);
pdata->children = eina_list_append(pdata->children, data);