Tizen Native API
Evas object smart interfaces

In this example, we illustrate how to create and handle Evas smart interfaces. Note that we use the same code base of the Evas object smart objects example, here. We just augment it with an interfaces demonstration.

A smart interface is just a functions interface a given smart object is declaring to support and or use. In Evas, interfaces are very simple: no interface inheritance, no interface overriding. Their purpose is to extend an object's capabilities and behavior beyond the sub-classing schema.

Here, together with a custom smart object, we create and declare the object as using an Evas interface. It'll have a custom function, too, besides the add() and del() obligatory ones. To demonstrate interface data, which is bound to object instances, we'll have a string as this data.

Here is where we declare our interface:

Note that there's error checking for interfaces creation, by means of the add() method's return value (_iface1_add(), here).

Now note that here we are filling in the interface's fields dynamically. Let's move on to that code region:

As important as setting the function pointers, is declaring the private_size as to match exactly the size of the data blob we want to have allocated for us by Evas. This will happen automatically inside evas_smart_example_add(). Later, on this code, we deal exactly with that data blob, more specifically writing on it (as it's not done inside _iface1_add(), here:

Before accessing the interface data, we exercise the interface fetching call Evas Object Smart Interface Get function, with the name string we used to be interface's name. With that handle in hands, we issue Evas Object Smart Interface Data Get function and write the string we want as data on that memory region. That will make up for the string you get on _iface1_del().

The full example follows.