Re: [E-devel] C API => Unified API
Andreas Volz <[email protected]>
| Newsgroups | gmane.comp.window-managers.enlightenment.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 28.06.21 um 22:40 schrieb Cedric Bail: > > > On Monday, June 28th, 2021 at 11:47 AM, Andreas Volz <[email protected]> wrote: >> Am 28.06.21 um 17:52 schrieb Cedric Bail: >>> On Sunday, June 27th, 2021 at 12:55 PM, Andreas Volz [email protected] wrote: >>> > >>>> I often don't find a Unified API equivalent in the new Unified API. >>>> Sure, the easy and obvious ones no problem. But sometimes the design >>>> seems to be changed a lot. Is there a general advice? >>> > >>>> For example I use edje_object_part_external_param_*() much in my >>>> application. I thought it might be an equivalent in Efl.Ui.Layout_Part >>>> but I don't see an obvious function. >>> > >>>> So any hints in general or this special case? >>> > >>> Yes, I think this would be part of the efl_part API. Which should be something >>> like: >>> efl::eo::downcastefl::Text(layout.part("title")).text_set("hello"); >>> > >>> or in C: >>> efl_text_set(efl_part(layout, "title"), "hello"); >>> > >>> The efl_part object returned is an Eo object that can only be used for one call. If >>> you want to use it for more than that you need to increase its ref counting. Something >>> > >>> like that: >>> > >>> Eo *part = efl_ref(efl_part(layout, "title")); >>> efl_text_set(part, "hello"); >>> ... >>> efl_unref(part); >> > >> Hm, I'd assume this works for text objects. But with the external API[1] >> you could get/set also int/bool data if you know the object supports it >> without detail information of what UI type is the object. With the C API >> this is possible. > > With the efl_part, in the case of an external, you should actually get the object > itself, not some kind of wrapper. You might have to do something like: > Eo *obj = efl_content_get(efl_part(layout, "yourpart")); > > I am guessing you will need to do some casting in the C++ API, no idea on > that part I haven't played with it in a very long time and don't remember > enough. I searched my local headers and found a file efl_canvas_layout_part_external.eo[1] which defines (nearly) what I need. This shows internally the same code as you quoted above. I would have found it before but it seems the online docs are not recent. Maybe they need to be re-generated? https://www.enlightenment.org/develop/api/efl/canvas/layout_part_external/property/content => This topic does not exist yet But I still don't know how to set a non-text value on a efl_part. This were the reasons those tpes have been used in the old API. typedef enum _Edje_External_Param_Type { EDJE_EXTERNAL_PARAM_TYPE_INT, EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, EDJE_EXTERNAL_PARAM_TYPE_STRING, EDJE_EXTERNAL_PARAM_TYPE_BOOL, EDJE_EXTERNAL_PARAM_TYPE_CHOICE, EDJE_EXTERNAL_PARAM_TYPE_MAX } Edje_External_Param_Type; With this you could put a e.g. spinner in a Layout and assign a INT value and it just works. Without knowing what widget type exactly is used. regards Andreas [1] https://git.enlightenment.org/core/efl.git/tree/src/lib/edje/efl_canvas_layout_part_external.eo