On Sat, Apr 17, 2010 at 1:26 PM, Andreas Volz <li...@brachttal.net> wrote: > Hello, > > I search an simple C example for the edje external type. I found > something, but it doesn't compile and after I got it to compile it > doesn't work (crash). > > Does someone know a good example?
Well, I don't understand your question/requirement, but maybe is due edje EXTERNAL not having a clear public introduction yet :-) First, Edje EXTERNAL is our hope to automatize object creation + SWALLOW, as it tend to be quite tedious. It's almost the same as the GROUP type, but it work with non-Edje as well, like Emotion and Elementary, in future EPDF/EDVI/EPS and so on. In essence it is just an automatic swallow, using the "source: name" part-level entry to specify the object to load. The "name" string will be looked up in a hash table that is either registered by the application itself using edje_external_type_register()/edje_external_type_array_register() or automatically by edje using the externals {} block that will load the module from ${prefix}/lib/edje/ Editje, for instance, add the used external modules to the file with: externals { external: "elm"; } Then you can load that file with any program, and /usr/lib/edje/elm.so will be called the eina module init, that in turn will call edje_external_type_array_register() automatically, making all "elm/*" strings available to EXTERNAL parts. You can try these things in edje_player or edje_viewer, or even e17 borders :-D (border decorations that play video!? :-P) In order to help with common tasks even further, like define the video path (if fixed), button label/icon and such common initialized elements, Edje EXTERNAL parts take parameters per-state. So you can even specify multiple states that have different parameters. Upon state change these parameters will be applied, reducing requirement for C/C++/Python code even further. Basically that is Edje EXTERNAL support for a "UI Designer" point of view, you specify non-native objects to be loaded there and you say how they should look like. Try editje to get some files, or use its own example in editje/test/sample.edc. You can see example of Emotion usage in my email http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg24939.html For the application developer point of view, you can just handle it as other part, ignoring it if it was not expected by you, or using edje_object_part_external_object_get(), or other functions to set basic parameters with edje_object_part_external_param_set(). However, it is advised that if the application developer knows it should be a specific object type, say elm/button, then user should use the edje_object_part_external_object_get() followed by native calls as elm_button_label_set(). This is important for performance reasons. The helper edje_object_part_external_param_set() in the case applications do not need performance or they can deal with multitude of object types that have the same property names (like we do in Edje itself with TEXT and TEXTBLOCK, edje_object_part_text_set() works for both). The multitude of objects, in this case, would be defined by the UI designer, like a using a a elm/button or elm/radio, they all have "label" property. Not all methods are supported by Edje EXTERNAL, and they will likely remain as it. For instance, we support elm/list, but you need to add the list items from C code. Last but not least, you have the developer that provides EXTERNAL objects, that are used by the above cases. This is being done by ProFUSION for most of Elementary widgets and is quite complete, maybe too much to use as learning base. So I did the Emotion version in emotion/src/edje_external. It is quite simple to understand. Basically you expose some meta-information targeted at Editors (like Editje) so it can show label, description, icon... It also provides some callbacks to let you do your work, like creating the object and set/get of properties. Overall we already noticed some missing bits, like a way to instruct the Editors that some properties are read-only, write-only or should be used just once for construction of the objects. These flags will come with time. BR, -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel