Open lauromoura opened 5 years ago
Option A
<Box efl:orientation="Vertical">
<Spotlight.ManagerStack efl:name="manager" />
<Spotlight.Container efl:name="container" efl:manager="@name/manager">
<Button efl:text="A" />
<Button efl:text="B" />
</Spotlight.Container>
</Box>
Which would roughly translate naturally to
var manager = new Efl.Ui.Spotlight.ManagerStack(box);
manager.Name = "manager";
var container = new Efl.Ui.Spotlight.Container(box);
container.Name = "container";
container.Manager = manager;
....
Option B
<Box efl:orientation="Vertical">
<Spotlight.Container efl:name="container" efl:parent="@name/manager">
<Spotlight.ManagerStack efl:name="manager"/>
<Button efl:text="A" />
<Button efl:text="B" />
</Spotlight.Container>
</Box>
This makes the manager a nested object of the container. The compiler will still have to figure out the order of setting the properties so it doesn't try to reference something before it is declared/instantiated.
Option C
<Box efl:orientation="Vertical">
<Spotlight efl:name="container" efl:manager="Stack">
<Button efl:text="A" />
<Button efl:text="B" />
</Spotlight>
</Box>
The EXML library would have some "internal knowledge" of the Spotlight API so it could take shortcuts in the declaration. This seems better but may not scale well if we have many "special cases"
Option D
<Box efl:orientation="Vertical">
<Spotlight efl:name="container" efl:manager="@class/Spotlight.ManagerStack">
<Button efl:text="A" />
<Button efl:text="B" />
</Spotlight>
</Box>
This is a variation of Option C above as instead of handling the actual internals of the Spotlight
API, it sees the @class/
prefix and the compiler would know it is an anonymous object
that will be used only once. That way it can create and set it locally.
About prefixing, we could use @name/
in a similar way to @id
from android.
If one does not reference the object in other parts by name, it may have no name.
Some EFL classes like
Spotlight.Container
have the option to reference non-ui instances like itsmanager
property, which is anSpotlight.Manager
. Some other places in the EFL API we may end up encountering the scenario where the parameter of a property is an object that needs to be instantiated elsewhere.How do we declare and reference them?