On the Tizen OS, there is a nice genlist style 1text
.
It creates a "magnifier" effect on the list, ie: top and bottom items are smaller then the one in the middle:
And they are smoothly coming larger as user moves them into the middle.
I wanted to customize the genlist's item style, so I searched online, and have created myownlistitem
.
My goal is to make the text red immediately when the item is highlighted (ie. brought into the middle). To be sure the program is using my layout, I've made the text's color purple by default:
group { "elm/genlist/item/myownlistitem/default";
data.item: "texts" "elm.text";
parts {
rect { "elm.spacer";
scale: 1;
mouse_events: 1;
desc { "default";
min: 0 100;
}
}
text { "elm.text";
desc { "default";
color: 255 0 255 255; // to be purple by default
text.size: 28;
}
desc { "highlighted";
inherit: "default";
color: 255 0 0 255; // to be red
}
}
}
programs {
program { name: "myownlistitem_highlighted";
signal: "elm,state,highlighted";
source: "elm";
action: STATE_SET "highlighted" 0;
target: "elm.text"
}
program { name: "myownlistitem_unhighlighted";
signal: "elm,state,unhighlighted";
source: "elm";
action: STATE_SET "default";
target: "elm.text"
}
}
}
This is very nice, works as intended:
But as you can see, I have lost the magnifier effect of 1text
.
So I went one bit further and changed back the list items' class to 1text
, and in listItemClass->func.content_get
:
Evas_Object* UI::getListItemContent(void* data, Evas_Object* obj, const char* part) {
Evas_Object* item = elm_layout_add(obj);
elm_layout_file_set(mylayout.edj, "elm/genlist/item/myownlistitem/default");
elm_object_part_text_set(item, "elm.text", "Demo");
return item;
}
It is actually working, magnifier effect stayed:
But my layout is no longer getting the highlighted
and unhighlighted
signals. I tried a lot of things from C code (*_signal_callback_add
) but never been able to receive these signals anymore.
How can I get these signals in my layout when applying it to keep the magnifier effect too?
question from:
https://stackoverflow.com/questions/65917634/customizing-1text-item-in-genlist-and-receive-highlighted-signal 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…