void test_genlist4(void *data, Evas_Object *obj, void *event_info);
void test_genlist5(void *data, Evas_Object *obj, void *event_info);
void test_genlist6(void *data, Evas_Object *obj, void *event_info);
+void test_genlist7(void *data, Evas_Object *obj, void *event_info);
void test_table(void *data, Evas_Object *obj, void *event_info);
void test_gengrid(void *data, Evas_Object *obj, void *event_info);
void test_pager(void *data, Evas_Object *obj, void *event_info);
ADD_TEST("Genlist 3", test_genlist3);
ADD_TEST("Genlist 4", test_genlist4);
ADD_TEST("Genlist 5", test_genlist5);
+ ADD_TEST("Genlist 7", test_genlist7);
ADD_TEST("Genlist Tree", test_genlist6);
ADD_TEST("GenGrid", test_gengrid);
ADD_TEST("Checks", test_check);
evas_object_resize(win, 320, 320);
evas_object_show(win);
}
+
+/*************/
+
+struct genlist7_data
+{
+ Evas_Object *win, *pager;
+};
+
+static Elm_Genlist_Item_Class itc7;
+static void
+gl_sel7(void *data, Evas_Object *obj, void *event_info)
+{
+ if (!event_info) return;
+ elm_genlist_item_item_class_update(event_info, &itc7);
+ printf("sel item data [%p] on genlist obj [%p], item pointer [%p], new item style [%s] \n", data, obj, event_info, itc7.item_style);
+}
+
+static void
+test_genlist7_back_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ struct genlist7_data *info = data;
+ if (!info) return;
+
+ elm_pager_content_pop(info->pager);
+}
+
+static void
+test_genlist7_swipe(void *data, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ struct genlist7_data *info = data;
+ Evas_Object *box, *entry, *button;
+ char item_data[] = "Just a simple test";
+
+ if ((!event_info) || (!data)) return;
+
+ box = elm_box_add(info->win);
+ elm_box_homogenous_set(box, 0);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(box);
+
+ entry = elm_scrolled_entry_add(info->win);
+ elm_scrolled_entry_editable_set(entry, EINA_FALSE);
+ elm_scrolled_entry_entry_set(entry, item_data);
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(entry);
+
+ button = elm_button_add(info->win);
+ elm_button_label_set(button, "back");
+ evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0);
+ evas_object_smart_callback_add(button, "clicked", test_genlist7_back_cb,
+ info);
+ evas_object_show(button);
+
+ elm_box_pack_start(box, entry);
+ elm_box_pack_end(box, button);
+
+ elm_pager_content_push(info->pager, box);
+}
+
+void
+test_genlist7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bg, *gl, *pager;
+ static struct genlist7_data info;
+ static Testitem tit[3];
+
+ win = elm_win_add(NULL, "genlist-7", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Genlist 7");
+ elm_win_autodel_set(win, 1);
+ info.win = win;
+
+ 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);
+
+ pager = elm_pager_add(win);
+ elm_win_resize_object_add(win, pager);
+ evas_object_size_hint_weight_set(pager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(pager, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(pager);
+ info.pager = pager;
+
+ 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_smart_callback_add(gl, "swipe", test_genlist7_swipe, &info);
+ evas_object_show(gl);
+ elm_pager_content_push(pager, gl);
+
+ itc2.item_style = "default";
+ itc2.func.label_get = gl2_label_get;
+ itc2.func.icon_get = gl2_icon_get;
+ itc2.func.state_get = gl2_state_get;
+ itc2.func.del = gl2_del;
+
+ itc7.item_style = "double_label";
+ itc7.func.label_get = gl5_label_get;
+ itc7.func.icon_get = gl5_icon_get;
+ itc7.func.state_get = gl5_state_get;
+ itc7.func.del = gl5_del;
+
+ tit[0].mode = 0;
+ tit[0].item = elm_genlist_item_append(gl, &itc2,
+ &(tit[0])/* item data */, NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
+ NULL/* func data */);
+ tit[1].mode = 1;
+ tit[1].item = elm_genlist_item_append(gl, &itc2,
+ &(tit[1])/* item data */, NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
+ NULL/* func data */);
+ tit[2].mode = 2;
+ tit[2].item = elm_genlist_item_append(gl, &itc2,
+ &(tit[2])/* item data */, NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE, gl_sel7/* func */,
+ NULL/* func data */);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
#endif
EAPI int elm_genlist_block_count_get(const Evas_Object *obj);
EAPI void elm_genlist_longpress_timeout_set(Evas_Object *obj, double timeout);
EAPI double elm_genlist_longpress_timeout_get(const Evas_Object *obj);
- EAPI void elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode);
- EAPI void elm_genlist_pinch_zoom_set(Evas_Object *obj, Eina_Bool emode);
- EAPI void elm_genlist_pinch_zoom_mode_set(Evas_Object *obj, Eina_Bool emode);
- EAPI Eina_Bool elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj);
- EINA_DEPRECATED EAPI void elm_genlist_queue_exception_set(const Evas_Object *obj, Eina_Bool emode);
-
-
/* operations to add items */
EAPI Elm_Genlist_Item *elm_genlist_item_append(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
EAPI Elm_Genlist_Item *elm_genlist_item_prepend(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Evas_Smart_Cb func, const void *func_data);
* double_label
* icon_top_text_bottom
*/
-
/* Genlist Item operation */
EAPI Elm_Genlist_Item *elm_genlist_item_next_get(const Elm_Genlist_Item *item);
EAPI Elm_Genlist_Item *elm_genlist_item_prev_get(const Elm_Genlist_Item *item);
EAPI Eina_Bool elm_genlist_item_selected_get(const Elm_Genlist_Item *item);
EAPI void elm_genlist_item_expanded_set(Elm_Genlist_Item *item, Eina_Bool expanded);
EAPI Eina_Bool elm_genlist_item_expanded_get(const Elm_Genlist_Item *item);
+ EAPI int elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it);
EAPI void elm_genlist_item_disabled_set(Elm_Genlist_Item *item, Eina_Bool disabled);
EAPI Eina_Bool elm_genlist_item_disabled_get(const Elm_Genlist_Item *item);
EAPI void elm_genlist_item_display_only_set(Elm_Genlist_Item *it, Eina_Bool display_only);
EAPI void elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data);
EAPI const Evas_Object *elm_genlist_item_object_get(const Elm_Genlist_Item *it);
EAPI void elm_genlist_item_update(Elm_Genlist_Item *item);
+ EAPI void elm_genlist_item_item_class_update(Elm_Genlist_Item *it, const Elm_Genlist_Item_Class *itc);
EAPI void elm_genlist_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
EINA_DEPRECATED EAPI void elm_genlist_set_edit_mode(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *ec);
EAPI void elm_genlist_edit_mode_set(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *ec);
- EAPI int elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it);
EAPI void elm_genlist_edit_selected_items_del(Evas_Object *obj);
EINA_DEPRECATED EAPI void elm_genlist_selected_items_del(Evas_Object *obj);
EAPI Eina_List * elm_genlist_edit_selected_items_get(const Evas_Object *obj);
EAPI void elm_genlist_groupitem_del( Elm_Genlist_GroupItem *git);
EAPI Elm_Genlist_Item *elm_genlist_item_append_with_group(Evas_Object *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Genlist_Item *parent, Elm_Genlist_Item_Flags flags, Elm_Genlist_GroupItem *git, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *func_data);
EAPI void elm_genlist_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after );
+ EAPI void elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode);
+ EAPI void elm_genlist_pinch_zoom_set(Evas_Object *obj, Eina_Bool emode);
+ EAPI void elm_genlist_pinch_zoom_mode_set(Evas_Object *obj, Eina_Bool emode);
+ EAPI Eina_Bool elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj);
+ EINA_DEPRECATED EAPI void elm_genlist_queue_exception_set(const Evas_Object *obj, Eina_Bool emode);
EAPI Evas_Object *elm_check_add(Evas_Object *parent);
EAPI void elm_check_label_set(Evas_Object *obj, const char *label);
#include "els_scroller.h"
#define SWIPE_MOVES 12
+#define MAX_ITEMS_PER_BLOCK 32
+#define LONGPRESS_TIMEOUT 1.0
/**
* @defgroup Genlist Genlist
wd->obj = obj;
wd->mode = ELM_LIST_SCROLL;
+ wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
wd->max_items_per_block = 32;
- wd->longpress_timeout = 1.0;
+ wd->longpress_timeout = LONGPRESS_TIMEOUT;
wd->max_git_num = 0;
evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
{
wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
it->rel = NULL;
- it->before = 0;
}
else
{
EINA_INLIST_GET(it2));
it->rel = it2;
it->rel->relcount++;
- it->before = 0;
}
+ it->before = 0;
_item_queue(wd, it);
return it;
}
}
/**
+ * Update the item class of an item
+ *
+ * @param it The item
+ * @parem itc The item class for the item
+ *
+ * @ingroup Genlist
+ */
+EAPI void
+elm_genlist_item_item_class_update(Elm_Genlist_Item *it, const Elm_Genlist_Item_Class *itc)
+{
+ if (!it) return;
+ if (!it->block) return;
+ if (!itc) return;
+ if (it->delete_me) return;
+ it->itc = itc;
+ elm_genlist_item_update(it);
+}
+
+/**
* This sets the horizontal stretching mode
*
* This sets the mode used for sizing items horizontally. Valid modes are
* Set compress mode
*
* This will enable the compress mode where items are "compressed" horizontally
- * to fit the genlist scrollable viewport width. this is special for gnelist.
- * do not rely on elm_genlist_horizontal_mode_set() being set to
+ * to fit the genlist scrollable viewport width. This is special for genlist.
+ * Do not rely on elm_genlist_horizontal_mode_set() being set to
* ELM_LIST_COMPRESS to work as genlist needs to handle it specially.
*
* @param obj The genlist object