On Wed, 01 Jun 2011 18:07:05 +0900 Sohyun Kim <anna1014....@samsung.com> said:
there is a downside of this patch.... resizes of the genlist horizontally lead
to horrible flickering as the items are deleted and re-realized AFTER a redraw
happened... this isn't too good :( btw - attached updated patch as i had to
merge changes after i put in other patches in upstream efl. :(
> Hello, this is Sohyun.
>
> I made a patch for elm_genlist.
> Elm_genlist cannot contain multiline entries because the height of multiline
> entry is decided after calculating elm_genlist_item height.
>
> I added changed_size_hint event callback for elm_genlist icons.
> When an icon size is changed, elm_genlist recalculates the item height.
> In other words, if multiline entry height is decided, elm_genlist_item
> height is recalculated.
>
> Elm_genlist may have many multiline entries, so I added recalculating
> routine as a job.
> If many multiline entries are resized, the elm_genlist recalculating routine
> will be run once.
>
> You can check elementary_test > genlist 6
>
> Thanks
>
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) ras...@rasterman.com
Index: src/lib/elm_genlist.c
===================================================================
--- src/lib/elm_genlist.c (revision 59889)
+++ src/lib/elm_genlist.c (working copy)
@@ -205,7 +205,7 @@
Eina_List *group_items;
Pan *pan;
Evas_Coord pan_x, pan_y, old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
- Ecore_Job *calc_job, *update_job;
+ Ecore_Job *calc_job, *update_job, *changed_job;
Ecore_Idle_Enterer *queue_idle_enterer;
Ecore_Idler *must_recalc_idler;
Eina_List *queue, *selected;
@@ -377,6 +377,8 @@
static void _calc_job(void *data);
static void _on_focus_hook(void *data,
Evas_Object *obj);
+static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _changed_job(void *data);
static Eina_Bool _item_multi_select_up(Widget_Data *wd);
static Eina_Bool _item_multi_select_down(Widget_Data *wd);
static Eina_Bool _item_single_select_up(Widget_Data *wd);
@@ -704,6 +706,7 @@
_item_cache_zero(wd);
if (wd->calc_job) ecore_job_del(wd->calc_job);
if (wd->update_job) ecore_job_del(wd->update_job);
+ if (wd->changed_job) ecore_job_del(wd->changed_job);
if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
@@ -1875,6 +1878,7 @@
edje_object_part_swallow(target, key, ic);
evas_object_show(ic);
elm_widget_sub_object_add(it->base.widget, ic);
+ evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
if (it->disabled)
elm_widget_disabled_set(ic, EINA_TRUE);
}
@@ -2438,6 +2442,17 @@
}
static void
+_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Elm_Genlist_Item *it = data;
+ if (!it) return;
+ it->mincalcd = EINA_FALSE;
+ it->block->updateme = EINA_TRUE;
+ if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
+ it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
+}
+
+static void
_group_items_recalc(void *data)
{
Widget_Data *wd = data;
@@ -2675,6 +2690,72 @@
}
static void
+_changed_job(void *data)
+{
+ Widget_Data *wd = data; Eina_List *l2;
+ Item_Block *itb;
+ int num, num0, position = 0, recalc = 0;
+ if (!wd) return;
+ wd->changed_job = NULL;
+ num = 0;
+ EINA_INLIST_FOREACH(wd->blocks, itb)
+ {
+ Evas_Coord itminw, itminh;
+ Elm_Genlist_Item *it;
+
+ if (!itb->updateme)
+ {
+ num += itb->count;
+ if (position)
+ _item_block_position(itb, num);
+ continue;
+ }
+ num0 = num;
+ recalc = 0;
+ EINA_LIST_FOREACH(itb->items, l2, it)
+ {
+ if (!it->mincalcd)
+ {
+ if (it->realized)
+ {
+ Evas_Coord mw = -1, mh = -1;
+ itminw = it->minw;
+ itminh = it->minh;
+
+ if (it->wd->height_for_width) mw = it->wd->w;
+ if (!it->display_only)
+ elm_coords_finger_size_adjust(1, &mw, 1, &mh);
+ if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
+ edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
+ if (!it->display_only)
+ elm_coords_finger_size_adjust(1, &mw, 1, &mh);
+ it->w = it->minw = mw;
+ it->h = it->minh = mh;
+ it->mincalcd = EINA_TRUE;
+
+ if ((it->minw != itminw) || (it->minh != itminh))
+ recalc = 1;
+ }
+ }
+ num++;
+ }
+ itb->updateme = EINA_FALSE;
+ if (recalc)
+ {
+ position = 1;
+ itb->changed = EINA_TRUE;
+ _item_block_recalc(itb, num0, 0);
+ _item_block_position(itb, num0);
+ }
+ }
+ if (position)
+ {
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+ }
+}
+
+static void
_pan_set(Evas_Object *obj,
Evas_Coord x,
Evas_Coord y)
Index: src/bin/test.c
===================================================================
--- src/bin/test.c (revision 59889)
+++ src/bin/test.c (working copy)
@@ -70,6 +70,7 @@
void test_genlist9(void *data, Evas_Object *obj, void *event_info);
void test_genlist10(void *data, Evas_Object *obj, void *event_info);
void test_genlist11(void *data, Evas_Object *obj, void *event_info);
+void test_genlist12(void *data, Evas_Object *obj, void *event_info);
void test_table(void *data, Evas_Object *obj, void *event_info);
void test_table2(void *data, Evas_Object *obj, void *event_info);
void test_table3(void *data, Evas_Object *obj, void *event_info);
@@ -335,6 +336,7 @@
ADD_TEST("Genlist 3", test_genlist3);
ADD_TEST("Genlist 4", test_genlist4);
ADD_TEST("Genlist 5", test_genlist5);
+ ADD_TEST("Genlist 6", test_genlist12);
ADD_TEST("Genlist 7", test_genlist7);
ADD_TEST("Genlist Tree", test_genlist6);
ADD_TEST("Genlist Group", test_genlist8);
Index: src/bin/test_genlist.c
===================================================================
--- src/bin/test_genlist.c (revision 59891)
+++ src/bin/test_genlist.c (working copy)
@@ -17,9 +17,9 @@
Elm_Genlist_Item *item;
int mode;
int onoff;
+ char *entry_text;
} Testitem;
-
static Elm_Genlist_Item_Class itc1;
char *gl_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
{
@@ -722,6 +722,7 @@
evas_object_show(bx);
gl = elm_genlist_add(win);
+ elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
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);
@@ -1897,4 +1898,84 @@
evas_object_resize(win, 400, 500);
evas_object_show(win);
}
+
+static Elm_Genlist_Item_Class itc12;
+static void
+_entry_del(void *data, Evas *e __UNUSED__, Evas_Object *o, void *event_info __UNUSED__)
+{
+ Testitem *tit = data;
+ const char *text;
+ if (tit->entry_text)
+ {
+ free(tit->entry_text);
+ tit->entry_text = NULL;
+ }
+ text = elm_entry_entry_get(o);
+ tit->entry_text = calloc(strlen(text)+1, sizeof(char));
+ strcpy(tit->entry_text, text);
+}
+
+static Evas_Object *
+gl12_icon_get(void *data, Evas_Object *obj, const char *part)
+{
+ Testitem *tit = data;
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+ Evas_Object *entry;
+ entry = elm_entry_add(obj);
+ if (tit->entry_text)
+ elm_entry_entry_set(entry, tit->entry_text);
+ else {
+ tit->entry_text = calloc(256, sizeof(char));
+ strcpy(tit->entry_text, "ashj ascjscjh n asjkl hcjlh ls hzshnn zjh sh zxjcjsnd h dfw sdv edev efe fwefvv vsd cvs ws wf fvwf wd fwe f we wef we wfe rfwewef wfv wswf wefg sdfws w wsdcfwcf wsc vdv sdsd sdcd cv wsc sdcv wsc d sdcdcsd sdcdsc wdvd sdcsd wscxcv wssvd sd");
+ elm_entry_entry_set(entry, tit->entry_text);
+ }
+ evas_object_event_callback_add(entry, EVAS_CALLBACK_DEL, _entry_del, data);
+ evas_object_show(entry);
+ return entry;
+ }
+ return NULL;
+}
+
+void
+test_genlist12(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bg, *gl;
+ static Testitem tit[5];
+ int i;
+
+ win = elm_win_add(NULL, "genlist12", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Genlist 12");
+ elm_win_autodel_set(win, 1);
+
+ 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);
+
+ gl = elm_genlist_add(win);
+ elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
+ 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);
+ elm_win_resize_object_add(win, gl);
+ evas_object_show(gl);
+
+ itc12.item_style = "non_selected_icon";
+ itc12.func.label_get = NULL;
+ itc12.func.icon_get = gl12_icon_get;
+ itc12.func.state_get = gl_state_get;
+ itc12.func.del = gl_del;
+
+
+ for (i = 0; i < 5; i++)
+ {
+ tit[i].mode = i;
+ tit[i].item = elm_genlist_item_append(gl, &itc12,
+ &(tit[i])/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE/* flags */,
+ gl_sel/* func */, NULL/* func data */);
+ }
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
#endif
Index: data/themes/default.edc
===================================================================
--- data/themes/default.edc (revision 59890)
+++ data/themes/default.edc (working copy)
@@ -17166,6 +17166,192 @@
}
}
+ group { name: "elm/genlist/item_compress/non_selected_icon/default";
+ data.item: "selectraise" "on";
+ //data.item: "labels" "elm.text";
+ data.item: "icons" "elm.swallow.icon";
+ data.item: "treesize" "20";
+// data.item: "states" "";
+ images {
+ image: "bt_sm_base1.png" COMP;
+ image: "ilist_1.png" COMP;
+ image: "ilist_2.png" COMP;
+ image: "ilist_item_shadow.png" COMP;
+ }
+ parts {
+ part {
+ name: "event";
+ type: RECT;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "base_sh";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ min: 0 10;
+ fixed: 1 1;
+ rel1 {
+ to: "base";
+ relative: 0.0 1.0;
+ offset: 0 0;
+ }
+ rel2 {
+ to: "base";
+ relative: 1.0 1.0;
+ offset: -1 0;
+ }
+ image {
+ normal: "ilist_item_shadow.png";
+ }
+ fill.smooth: 0;
+ }
+ description {
+ state: "default" 1.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "base";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ image {
+ normal: "ilist_1.png";
+ border: 2 2 2 2;
+ }
+ fill.smooth: 0;
+ }
+ description {
+ state: "default" 1.0;
+ inherit: "default" 0.0;
+ image.normal: "ilist_2.png";
+ }
+ }
+ part { name: "bg";
+ clip_to: "disclip";
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ visible: 0;
+ color: 255 255 255 0;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: -5 -5;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: 4 4;
+ }
+ image {
+ normal: "bt_sm_base1.png";
+ border: 6 6 6 6;
+ }
+ image.middle: SOLID;
+ }
+ description { state: "selected" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ color: 255 255 255 255;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: -2 -2;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: 1 1;
+ }
+ }
+ }
+ part { name: "elm.swallow.pad";
+ type: SWALLOW;
+ description { state: "default" 0.0;
+ //fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 {
+ relative: 0.0 0.0;
+ offset: 4 4;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -4 -5;
+ }
+ }
+ }
+ part { name: "elm.swallow.icon";
+ clip_to: "disclip";
+ type: SWALLOW;
+ description { state: "default" 0.0;
+ //fixed: 1 0;
+ align: 0.5 0.5;
+ rel1 {
+ to_x: "elm.swallow.pad";
+ relative: 0.0 0.0;
+ offset: -1 4;
+ }
+ rel2 {
+ to_x: "elm.swallow.pad";
+ relative: 1.0 1.0;
+ offset: -1 -5;
+ }
+ }
+ }
+ part { name: "disclip";
+ type: RECT;
+ description { state: "default" 0.0;
+ rel1.to: "bg";
+ rel2.to: "bg";
+ }
+ description { state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 64;
+ }
+ }
+ }
+ programs {
+ // signal: elm,state,%s,active
+ // a "check" item named %s went active
+ // signal: elm,state,%s,passive
+ // a "check" item named %s went passive
+ // default is passive
+ program {
+ name: "odd";
+ signal: "elm,state,odd";
+ source: "elm";
+ action: STATE_SET "default" 1.0;
+ target: "base_sh";
+ target: "base";
+ }
+ program {
+ name: "even";
+ signal: "elm,state,even";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "base_sh";
+ target: "base";
+ }
+ program {
+ name: "go_disabled";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "go_enabled";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disclip";
+ }
+ }
+ }
+
group { name: "elm/genlist/tree/default/default";
data.item: "selectraise" "on";
data.item: "labels" "elm.text";
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel