-#include <Elementary.h>
#include <Elementary_Cursor.h>
#include "test.h"
#ifdef HAVE_CONFIG_H
#include "elementary_config.h"
#endif
+#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
struct _api_data
{
set_api_state(api_data *api)
{
const Eina_List *items = elm_box_children_get(api->box);
- if(!eina_list_count(items))
+ if (!eina_list_count(items))
return;
Evas_Object *gl = eina_list_nth(items, 0); /* Genlist is the first item */
break;
case NO_SELECT_MODE_SET: /* 1 */
- elm_genlist_no_select_mode_set(gl, EINA_TRUE);
+ elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_NONE);
elm_genlist_mode_set(gl, ELM_LIST_SCROLL); /* Back to default */
break;
case COMPRESS_MODE_SET: /* 2 */
- elm_genlist_no_select_mode_set(gl, EINA_FALSE); /* Back to default */
- elm_genlist_compress_mode_set(gl, EINA_TRUE);
+ elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
break;
case BOUNCE_SET: /* 3 */
case TOOLTIP_TEXT_SET: /* 6 */
{
elm_genlist_item_tooltip_text_set(elm_genlist_first_item_get(gl), "Tooltip text from API");
- elm_genlist_item_bring_in(elm_genlist_first_item_get(gl));
+ elm_genlist_item_bring_in(elm_genlist_first_item_get(gl),
+ ELM_GENLIST_ITEM_SCROLLTO_IN);
}
break;
} Testitem;
static Elm_Genlist_Item_Class *itc1;
-static Elm_Genlist_Item_Class *itc15;
char *gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
{
char buf[256];
static void
_bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- elm_genlist_item_bring_in(data);
+ elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_IN);
}
static void
_bt1500_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- elm_genlist_item_middle_bring_in(data);
+ elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
}
static void
Evas_Object *gl = data;
Elm_Object_Item *gli = elm_genlist_first_item_get(gl);
if (!gli) return;
- elm_genlist_item_show(gli);
+ elm_genlist_item_show(gli, ELM_GENLIST_ITEM_SCROLLTO_IN);
elm_genlist_item_selected_set(gli, 1);
}
Evas_Object *gl = data;
Elm_Object_Item *gli = elm_genlist_last_item_get(gl);
if (!gli) return;
- elm_genlist_item_show(gli);
+ elm_genlist_item_show(gli, ELM_GENLIST_ITEM_SCROLLTO_IN);
elm_genlist_item_selected_set(gli, 1);
}
evas_object_show(bx);
gl = elm_genlist_add(win);
- elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
+ elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
elm_genlist_multi_select_set(gl, 1);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
ic = elm_icon_add(obj);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
- elm_icon_scale_set(ic, 0, 0);
+ elm_icon_resizable_set(ic, 0, 0);
evas_object_show(ic);
elm_box_pack_end(bx, ic);
ic = elm_icon_add(obj);
elm_icon_file_set(ic, buf, NULL);
- elm_icon_scale_set(ic, 0, 0);
+ elm_icon_resizable_set(ic, 0, 0);
evas_object_show(ic);
elm_box_pack_end(bx, ic);
elm_box_horizontal_set(bx, EINA_TRUE);
evas_object_show(bx);
gl = elm_genlist_add(win);
- elm_genlist_always_select_mode_set(gl, 1);
+ elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(gl);
/*************/
-static Elm_Genlist_Item_Class itc4;
+static Elm_Genlist_Item_Class *itc4;
static void
gl4_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
Evas_Object *gl = elm_object_item_widget_get(glit);
int val = (int)(long) elm_object_item_data_get(glit);
val *= 10;
- elm_genlist_item_append(gl, &itc4,
+ elm_genlist_item_append(gl, itc4,
(void *)(long) (val + 1)/* item data */,
glit/* parent */, ELM_GENLIST_ITEM_NONE,
gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc4,
+ elm_genlist_item_append(gl, itc4,
(void *)(long) (val + 2)/* item data */,
glit/* parent */, ELM_GENLIST_ITEM_NONE,
gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc4,
+ elm_genlist_item_append(gl, itc4,
(void *)(long) (val + 3)/* item data */,
glit/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
}
static void
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(gl);
- itc4.item_style = "default";
- itc4.func.text_get = gl4_text_get;
- itc4.func.content_get = gl4_content_get;
- itc4.func.state_get = gl4_state_get;
- itc4.func.del = gl4_del;
+ itc4 = elm_genlist_item_class_new();
+ itc4->item_style = "default";
+ itc4->func.text_get = gl4_text_get;
+ itc4->func.content_get = gl4_content_get;
+ itc4->func.state_get = gl4_state_get;
+ itc4->func.del = gl4_del;
- elm_genlist_item_append(gl, &itc4,
- (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ elm_genlist_item_append(gl, itc4,
+ (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc4,
- (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ elm_genlist_item_append(gl, itc4,
+ (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
- elm_genlist_item_append(gl, &itc4,
+ elm_genlist_item_append(gl, itc4,
(void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl4_sel/* func */,
NULL/* func data */);
-
+ elm_genlist_item_class_free(itc4);
evas_object_smart_callback_add(gl, "expand,request", gl4_exp_req, gl);
evas_object_smart_callback_add(gl, "contract,request", gl4_con_req, gl);
evas_object_smart_callback_add(gl, "expanded", gl4_exp, gl);
static void
_bt_show_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- elm_genlist_item_top_show(data);
- //elm_genlist_item_show(data);
- //elm_genlist_item_middle_show(data);
+ elm_genlist_item_show(data, ELM_GENLIST_ITEM_SCROLLTO_TOP);
}
static void
_bt_bring_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- elm_genlist_item_top_bring_in(data);
- //elm_genlist_item_bring_in(data);
- //elm_genlist_item_middle_bring_in(data);
+ elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_TOP);
}
void
ELM_GENLIST_ITEM_GROUP,
gl_sel/* func */,
(void *)(long)(i * 10)/* func data */);
- elm_genlist_item_display_only_set(git, EINA_TRUE);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
}
else if (git)
{
elm_genlist_item_append(gl, itc1,
(void *)(long) (val + 3)/* item data */,
glit/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
}
git = elm_genlist_item_append(gl, &itc_group,
(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_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
elm_genlist_item_append(gl, itc1,
- (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ (void *)1/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
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,
- (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ (void *)3/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, 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_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
elm_genlist_item_append(gl, itc1,
- (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ (void *)5/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
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,
- (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_SUBITEMS, gl4_sel/* func */,
+ (void *)7/* item data */, git/* parent */, ELM_GENLIST_ITEM_TREE, gl4_sel/* func */,
NULL/* func data */);
elm_genlist_item_class_free(itc1);
if (!data) return;
int v = elm_radio_value_get(data);
if (v == 1)
- elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
+ elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_TRUE);
}
static void
if (!data) return;
int v = elm_radio_value_get(data);
if (v == 0)
- elm_genlist_item_mode_set(event_info, mode_type[v], EINA_TRUE);
+ elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_TRUE);
}
static void
if (!data) return;
int v = elm_radio_value_get(data);
if (v == 0)
- elm_genlist_item_mode_set(event_info, mode_type[v], EINA_FALSE);
+ elm_genlist_item_decorate_mode_set(event_info, mode_type[v], EINA_FALSE);
}
static void
fprintf(stderr, "drag\n");
if (!data) return;
int v = elm_radio_value_get(data);
- Elm_Object_Item *glit = (Elm_Object_Item *) elm_genlist_mode_item_get(obj);
- if (glit) elm_genlist_item_mode_set(glit, mode_type[v], EINA_FALSE);
+ Elm_Object_Item *glit = (Elm_Object_Item *) elm_genlist_decorated_item_get(obj);
+ if (glit) elm_genlist_item_decorate_mode_set(glit, mode_type[v], EINA_FALSE);
}
void
test_genlist10(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- Evas_Object *win, *fr, *lb, *bx, *bx2, *bx3, *rd, *rdg, *gl;
+ Evas_Object *win, *fr, *bx, *bx2, *rd, *rdg, *gl;
int i;
- win = elm_win_util_standard_add("genlist10", "Genlist Mode");
+ win = elm_win_util_standard_add("genlist-decorate-item-mode", "Genlist Decorate Item Mode");
elm_win_autodel_set(win, EINA_TRUE);
bx = elm_box_add(win);
evas_object_show(bx);
fr = elm_frame_add(win);
- elm_object_text_set(fr, "Mode Type");
+ elm_object_text_set(fr, "Decorate Mode Type");
elm_box_pack_end(bx, fr);
evas_object_show(fr);
elm_object_content_set(fr, bx2);
evas_object_show(bx2);
- lb = elm_label_add(win);
- elm_object_text_set(lb,
- "Sweep genlist items to the right.<br/>"
- "Test this by changing Mode Type to Slide or Rotate.");
- elm_box_pack_end(bx2, lb);
- evas_object_show(lb);
-
- bx3 = elm_box_add(win);
- elm_box_horizontal_set(bx3, EINA_TRUE);
- elm_box_pack_end(bx2, bx3);
- evas_object_show(bx3);
-
rd = elm_radio_add(win);
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_radio_state_value_set(rd, 0);
- elm_object_text_set(rd, "Slide ");
+ elm_object_text_set(rd, "Slide : Sweep genlist items to the right.");
evas_object_show(rd);
- elm_box_pack_end(bx3, rd);
+ elm_box_pack_end(bx2, rd);
rdg = rd;
rd = elm_radio_add(win);
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_radio_state_value_set(rd, 1);
- elm_object_text_set(rd, "Rotate");
+ elm_object_text_set(rd, "Rotate : Click each item.");
elm_radio_group_add(rd, rdg);
evas_object_show(rd);
- elm_box_pack_end(bx3, rd);
+ elm_box_pack_end(bx2, rd);
gl = elm_genlist_add(win);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(gl);
itc10.item_style = "default";
- itc10.mode_item_style = "mode";
+ itc10.decorate_item_style = "mode";
itc10.func.text_get = gl10_text_get;
itc10.func.content_get = gl10_content_get;
itc10.func.state_get = gl_state_get;
* @param obj : the genlist object.
* @param item : the moved item.
*
- * If the move_after is true,
+ * the item(*item) had been moved
+ *
+ */
+static void gl_moved(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
+{
+ // if needed, add application logic.
+}
+
+/**
+ * gl_moved_after is called after an item was reordered.
+ * This is only called when reorder mode is enabled.
+ *
+ * @param data : the genlist object passed as data.
+ * @param obj : the genlist object.
+ * @param item : the moved item.
+ *
* the item(*item) had been moved after the given relative item(*rel_item) in list.
- * If the move_after is false,
+ *
+ */
+static void gl_moved_after(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
+{
+ // if needed, add application logic.
+ Elm_Object_Item *it;
+ it = elm_genlist_item_prev_get(item);
+ printf("it=%p, prev_it=%p\n",item,it);
+}
+
+/**
+ * gl_moved_before is called after an item was reordered.
+ * This is only called when reorder mode is enabled.
+ *
+ * @param data : the genlist object passed as data.
+ * @param obj : the genlist object.
+ * @param item : the moved item.
+ *
* the item(*item) had been moved before the given relative item(*rel_item) in list.
*
*/
-static void gl_moved(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
+static void gl_moved_before(Evas_Object *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Object_Item *item __UNUSED__)
{
// if needed, add application logic.
+ Elm_Object_Item *it;
+ it = elm_genlist_item_next_get(item);
+ printf("it=%p, next_it=%p\n",item,it);
}
void
tg = elm_check_add(win);
elm_object_style_set(tg, "toggle");
elm_object_text_set(tg, "Reorder Mode:");
- elm_check_state_set(tg, elm_mirrored_get());
+ elm_check_state_set(tg, elm_config_mirrored_get());
evas_object_smart_callback_add(tg, "changed", _reorder_tg_changed_cb, gl);
elm_box_pack_end(bx, tg);
evas_object_show(tg);
itc1->func.state_get = gl_state_get;
itc1->func.del = NULL;
evas_object_smart_callback_add(gl, "moved", (Evas_Smart_Cb)gl_moved, gl);
+ evas_object_smart_callback_add(gl, "moved,after", (Evas_Smart_Cb)gl_moved_after, gl);
+ evas_object_smart_callback_add(gl, "moved,before", (Evas_Smart_Cb)gl_moved_before, gl);
for (i = 0; i < 50; i++)
elm_genlist_item_append(gl,
evas_object_show(bx);
gl = elm_genlist_add(win);
- elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
+ elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(bx, gl);
evas_object_show(gl);
+ itc1 = elm_genlist_item_class_new();
itc1->item_style = "message";
itc1->func.text_get = gl12_text_get;
itc1->func.content_get = gl_content_get;
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(gl);
- itc4.item_style = "default";
- itc4.func.text_get = gl4_text_get;
- itc4.func.content_get = NULL;
- itc4.func.state_get = NULL;
- itc4.func.del = NULL;
+ itc4 = elm_genlist_item_class_new();
+ itc4->item_style = "default";
+ itc4->func.text_get = gl4_text_get;
+ itc4->func.content_get = NULL;
+ itc4->func.state_get = NULL;
+ itc4->func.del = NULL;
/* mixed order to test insert sorted */
for (i = 0; i < 3; i++)
{
pi[i] = elm_genlist_item_sorted_insert
- (gl, &itc4, (void *)(long)idx[i]/* item data */, NULL/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, gl13_cmp/* cmp */,
+ (gl, itc4, (void *)(long)idx[i]/* item data */, NULL/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl13_cmp/* cmp */,
NULL/* func */, NULL/* func data */);
}
for (j = 0; j < 3; j++)
{
elm_genlist_item_sorted_insert
- (gl, &itc4, (void *)(long)(idx[j] + base)/* item data */,
+ (gl, itc4, (void *)(long)(idx[j] + base)/* item data */,
pi[i]/* parent */, ELM_GENLIST_ITEM_NONE,
gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */);
}
for (i = 0; i < 3; i++)
{
pi[i + 3] = elm_genlist_item_sorted_insert
- (gl, &itc4, (void *)(long)(idx[i] * 2)/* item data */, NULL/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, gl13_cmp/* cmp */, NULL/* func */,
+ (gl, itc4, (void *)(long)(idx[i] * 2)/* item data */, NULL/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl13_cmp/* cmp */, NULL/* func */,
NULL/* func data */);
}
for (j = 0; j < 3; j++)
{
elm_genlist_item_sorted_insert
- (gl, &itc4, (void *)(long)(idx[j] + base)/* item data */,
+ (gl, itc4, (void *)(long)(idx[j] + base)/* item data */,
pi[i + 3]/* parent */, ELM_GENLIST_ITEM_NONE,
gl13_cmp/* cmp */, NULL/* func */, NULL/* func data */);
}
}
-
+ elm_genlist_item_class_free(itc4);
elm_box_pack_end(bx, gl);
evas_object_show(bx);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(gl);
- itc1 = elm_genlist_item_class_new();
-
- itc4.item_style = "default";
- itc4.func.text_get = gl4_text_get;
- itc4.func.content_get = NULL;
- itc4.func.state_get = NULL;
- itc4.func.del = NULL;
+ itc4 = elm_genlist_item_class_new();
+ itc4->item_style = "default";
+ itc4->func.text_get = gl4_text_get;
+ itc4->func.content_get = NULL;
+ itc4->func.state_get = NULL;
+ itc4->func.del = NULL;
/* mixed order to test insert sorted */
// BUG2: should be able to insert after=NULL, append
pi[0] = elm_genlist_item_append
- (gl, &itc4, (void *)(long)idx[0]/* item data */,
+ (gl, itc4, (void *)(long)idx[0]/* item data */,
NULL/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
for (i = 1; i < 3; i++)
{
if (relative[i] < 0)
pi[i] = elm_genlist_item_insert_before
- (gl, &itc4, (void *)(long)idx[i]/* item data */,
+ (gl, itc4, (void *)(long)idx[i]/* item data */,
NULL/* parent */, pi[-relative[i]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
else
pi[i] = elm_genlist_item_insert_after
- (gl, &itc4, (void *)(long)idx[i]/* item data */,
+ (gl, itc4, (void *)(long)idx[i]/* item data */,
NULL/* parent */, pi[relative[i]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
}
for (i = 0; i < 3; i++)
base = 1000 * (int)(long) elm_object_item_data_get(pi[i]);
sub_glit[0] = elm_genlist_item_append
- (gl, &itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ (gl, itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
for (j = 1; j < 6; j++) {
if (relative[j] < 0)
sub_glit[j] = elm_genlist_item_insert_before
- (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
+ (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
pi[i]/* parent */, sub_glit[-relative[j]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
else
sub_glit[j] = elm_genlist_item_insert_after
- (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
+ (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
pi[i]/* parent */, sub_glit[relative[j]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
}
}
{
if (relative[i] < 0)
pi[i] = elm_genlist_item_insert_before
- (gl, &itc4, (void *)(long) idx[i]/* item data */,
+ (gl, itc4, (void *)(long) idx[i]/* item data */,
NULL/* parent */, pi[-relative[i]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
else
pi[i] = elm_genlist_item_insert_after
- (gl, &itc4, (void *)(long) idx[i]/* item data */,
+ (gl, itc4, (void *)(long) idx[i]/* item data */,
NULL/* parent */, pi[relative[i]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
}
for (i = 3; i < 6; i++)
base = 1000 * (int)(long) elm_object_item_data_get(pi[i]);
sub_glit[0] = elm_genlist_item_append
- (gl, &itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ (gl, itc4, (void *)(long) (idx[0] + base)/* item data */, pi[i]/* parent */,
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
for (j = 1; j < 6; j++) {
if (relative[j] < 0)
sub_glit[j] = elm_genlist_item_insert_before
- (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
+ (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
pi[i]/* parent */, sub_glit[-relative[j]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
else
sub_glit[j] = elm_genlist_item_insert_after
- (gl, &itc4, (void *)(long) (idx[j] + base)/* item data */,
+ (gl, itc4, (void *)(long) (idx[j] + base)/* item data */,
pi[i]/* parent */, sub_glit[relative[j]],
- ELM_GENLIST_ITEM_SUBITEMS, NULL/* func */, NULL/* func data */);
+ ELM_GENLIST_ITEM_TREE, NULL/* func */, NULL/* func data */);
}
}
elm_box_pack_end(bx, bx2);
evas_object_show(bx2);
- /* item_class_ref is needed for itc1. some items can be added in callbacks */
- elm_genlist_item_class_ref(itc1);
- elm_genlist_item_class_free(itc1);
+ /* item_class_ref is needed for itc4. some items can be added in callbacks */
+ elm_genlist_item_class_ref(itc4);
+ elm_genlist_item_class_free(itc4);
evas_object_resize(win, 320, 320);
evas_object_show(win);
{
Testitem *tit = data;
char buf[PATH_MAX];
- Evas_Object *ic = elm_icon_add(obj);
// "edit_default" EDC layout is like below. each part is swallow part.
// the existing item is swllowed to elm.swallow.edit.content part.
- // ----------------------------------------------------------------
- // | elm.edit.icon.1 | elm.swallow.edit.content | elm.edit.icon,2 |
- // ----------------------------------------------------------------
+ // --------------------------------------------------------------------
+ // | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 |
+ // --------------------------------------------------------------------
if (!strcmp(part, "elm.swallow.end"))
{
+ Evas_Object *ic = elm_icon_add(obj);
snprintf(buf, sizeof(buf), "%s/images/bubble.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
gl15_sel(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Testitem *tit = data;
- if (elm_genlist_edit_mode_get(obj))
+ if (elm_genlist_decorate_mode_get(obj))
{
if (!tit->checked) tit->checked = EINA_TRUE;
else tit->checked = EINA_FALSE;
}
static void
-gl15_edit_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+gl15_deco_all_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- elm_genlist_edit_mode_set(data, EINA_TRUE);
- elm_genlist_always_select_mode_set(data, EINA_TRUE);
+ elm_genlist_decorate_mode_set(data, EINA_TRUE);
+ elm_genlist_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS);
}
static void
gl15_normal_mode(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- elm_genlist_edit_mode_set(data, EINA_FALSE);
- elm_genlist_always_select_mode_set(data, EINA_FALSE);
+ elm_genlist_decorate_mode_set(data, EINA_FALSE);
+ elm_genlist_select_mode_set(data, ELM_OBJECT_SELECT_MODE_DEFAULT);
}
void gl15_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
printf("item deleted.\n");
}
+static Elm_Genlist_Item_Class *itc15;
void
test_genlist15(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- Evas_Object *win, *bg, *bx, *bx2, *bt, *gl;
+ Evas_Object *win, *bx, *bx2, *bt, *gl;
int i;
static Testitem tit[100];
- win = elm_win_add(NULL, "genlist15", ELM_WIN_BASIC);
- elm_win_title_set(win, "Genlist Edit Mode");
+ win = elm_win_util_standard_add("genlist-decorate-all-mode", "Genlist Decorate All Mode");
elm_win_autodel_set(win, EINA_TRUE);
- bg = elm_bg_add(win);
- elm_win_resize_object_add(win, bg);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(bg);
-
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
itc15->func.content_get = gl15_content_get;
itc15->func.state_get = gl_state_get;
itc15->func.del = gl15_del;
- itc15->edit_item_style = "edit";
+ itc15->decorate_all_item_style = "edit";
for (i = 0; i < 100; i++)
{
evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
bt = elm_button_add(win);
- elm_object_text_set(bt, "Edit mode");
- evas_object_smart_callback_add(bt, "clicked", gl15_edit_mode, gl);
+ elm_object_text_set(bt, "Decorate All mode");
+ evas_object_smart_callback_add(bt, "clicked", gl15_deco_all_mode, gl);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
evas_object_resize(win, 520, 520);
evas_object_show(win);
}
+
+static void _flip_icon_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ const Testitem *tit = data;
+
+ if (elm_genlist_item_flip_get(tit->item))
+ elm_genlist_item_flip_set(tit->item, EINA_FALSE);
+ else
+ elm_genlist_item_flip_set(tit->item, EINA_TRUE);
+}
+
+char *gl16_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
+{
+ const Testitem *tit = data;
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item #%i", tit->mode);
+ return strdup(buf);
+}
+
+Evas_Object *gl16_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ Testitem *tit = data;
+ char buf[PATH_MAX];
+
+ if (!strcmp(part, "elm.text.flip"))
+ {
+ Evas_Object *btn = elm_button_add(obj);
+ elm_object_text_set(btn, "flipped content placement");
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_smart_callback_add(btn, "clicked", _flip_icon_clicked_cb, (void *)tit);
+ evas_object_show(btn);
+ return btn;
+ }
+ else if (!strcmp(part, "elm.edit.icon.1"))
+ {
+ Evas_Object *icn = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/icon_04.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(icn, buf, NULL);
+ evas_object_propagate_events_set(icn, EINA_FALSE);
+ evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return icn;
+ }
+ else if (!strcmp(part, "elm.edit.icon.2"))
+ {
+ Evas_Object *icn = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/icon_09.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(icn, buf, NULL);
+ evas_object_propagate_events_set(icn, EINA_FALSE);
+ evas_object_size_hint_aspect_set(icn, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ evas_object_smart_callback_add(icn, "clicked", _flip_icon_clicked_cb, (void *)tit);
+ return icn;
+ }
+ else return NULL;
+}
+
+void
+test_genlist16(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bx, *gl;
+ int i;
+ static Testitem tit[100];
+
+ win = elm_win_util_standard_add("genlist-flip-mode", "Genlist Flip Mode");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ gl = elm_genlist_add(win);
+ evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(gl);
+
+ /* note: flip mode can be used with/without edit mode */
+ elm_genlist_decorate_mode_set(gl, EINA_TRUE);
+ elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ itc15 = elm_genlist_item_class_new();
+ itc15->item_style = "default";
+ itc15->func.text_get = gl16_text_get;
+ itc15->func.content_get = gl16_content_get;
+ itc15->func.state_get = gl_state_get;
+ itc15->func.del = NULL;
+ itc15->decorate_all_item_style = "edit";
+
+ for (i = 0; i < 100; i++)
+ {
+ tit[i].mode = i;
+ tit[i].item = elm_genlist_item_append(gl, itc15,
+ &(tit[i])/* item data */,
+ NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE/* flags */,
+ gl_sel/* func */,
+ (void *)(long)&(tit[i])/* func data */);
+ }
+ elm_genlist_item_class_free(itc15);
+ elm_box_pack_end(bx, gl);
+ evas_object_show(bx);
+
+ evas_object_resize(win, 520, 520);
+ evas_object_show(win);
+}
+
+static Elm_Genlist_Item_Class itc17;
+
+static void
+gl17_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ int depth = elm_genlist_item_expanded_depth_get(glit);
+ printf("expanded depth for selected item is %d\n", depth);
+}
+
+static void
+gl17_exp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ Evas_Object *gl = elm_object_item_widget_get(glit);
+ int val = (int)(long) elm_object_item_data_get(glit);
+ val *= 10;
+ elm_genlist_item_append(gl, &itc17,
+ (void *)(long) (val + 1)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)(long) (val + 2)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)(long) (val + 3)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)(long) (val + 4)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)(long) (val + 5)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)(long) (val + 6)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+}
+
+static void
+gl17_con(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_subitems_clear(glit);
+}
+
+static void
+gl17_exp_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_expanded_set(glit, EINA_TRUE);
+}
+
+static void
+gl17_con_req(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_expanded_set(glit, EINA_FALSE);
+}
+
+char *gl17_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item mode %i", (int)(long)data);
+ return strdup(buf);
+}
+
+Evas_Object *gl17_content_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
+{
+ char buf[PATH_MAX];
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+ Evas_Object *ic = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_icon_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ evas_object_show(ic);
+ return ic;
+ }
+ else if (!strcmp(part, "elm.swallow.end"))
+ {
+ Evas_Object *ck;
+ ck = elm_check_add(obj);
+ evas_object_propagate_events_set(ck, EINA_FALSE);
+ evas_object_show(ck);
+ return ck;
+ }
+ return NULL;
+}
+
+Eina_Bool gl17_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
+{
+ return EINA_FALSE;
+}
+
+void gl17_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
+{
+ printf("item deleted.\n");
+}
+
+static void
+gl17_enabled_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ elm_genlist_tree_effect_enabled_set(data, EINA_TRUE);
+}
+
+static void
+gl17_disabled_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ elm_genlist_tree_effect_enabled_set(data, EINA_FALSE);
+}
+
+void
+test_genlist17(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *gl, *bx, *bx2, *bt;
+
+ win = elm_win_util_standard_add("genlist17", "Genlist Tree Effect");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ gl = elm_genlist_add(win);
+ evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(gl);
+
+ elm_genlist_tree_effect_enabled_set(gl,EINA_TRUE);
+
+ itc17.item_style = "tree_effect";
+ itc17.func.text_get = gl17_text_get;
+ itc17.func.content_get = gl17_content_get;
+ itc17.func.state_get = gl17_state_get;
+ itc17.func.del = gl17_del;
+
+ elm_genlist_item_append(gl, &itc17,
+ (void *)1/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)2/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+ elm_genlist_item_append(gl, &itc17,
+ (void *)3/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_TREE, gl17_sel/* func */,
+ NULL/* func data */);
+
+ evas_object_smart_callback_add(gl, "expand,request", gl17_exp_req, gl);
+ evas_object_smart_callback_add(gl, "contract,request", gl17_con_req, gl);
+ evas_object_smart_callback_add(gl, "expanded", gl17_exp, gl);
+ evas_object_smart_callback_add(gl, "contracted", gl17_con, gl);
+
+ elm_box_pack_end(bx, gl);
+ evas_object_show(bx);
+
+ bx2 = elm_box_add(win);
+ elm_box_horizontal_set(bx2, EINA_TRUE);
+ elm_box_homogeneous_set(bx2, EINA_TRUE);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Enable");
+ evas_object_smart_callback_add(bt, "clicked", gl17_enabled_set, gl);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Disable");
+ evas_object_smart_callback_add(bt, "clicked", gl17_disabled_set, gl);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
#endif