This topic explains the programming principles of EFL. Due to its hierarchical structure, EFL has certain characteristics distinguished from other frameworks, to which you need to pay attention while programming.
Evas library is in charge of rendering in EFL, and it renders graphics by displaying a unit called an Evas object. It defines the data structure of the object type and provides the
Evas_Object handle. In short, all graphical objects in EFL have the same data type:
The following code snippet shows the return type of several EFL APIs:
Evas_Object* win; Evas_Object* btn; Evas_Object* rect; Evas_Object* img; win = elm_win_util_standard_add("test", "test"); btn = elm_button_add(parent); rect = evas_object_rectangle_add(evas); img = evas_object_image_add(evas);
In the above example, the object created by each function has the
Evas_Object*type, whether they are a window or a button. Remember that Elementary is a wrapper of EFL, including Evas for user convenience.
Evas_Object*type, whether they are a rectangle or an image.
Although Evas treats its objects equally, they have types which define their specific behavior and individual API.
All graphical objects in EFL (which are of the
Evas_Object type) are hidden by default. This avoids unwanted events, such as mouse in, move, and out events due to objects being created underneath the current pointer position. It is more efficient, as you can show the object after you have finished defining its state. To show an object, you need to call the
evas_object_show() function explicitly.
The following code snippet shows the process of displaying an object:
/* Create a checkbox, which is invisible by default */ check = elm_check_add(parent); /* Define its state */ elm_check_state_set(check, EINA_TRUE); /* Switch the checkbox into a visible state */ evas_object_show(check);
An EFL function has its own range of effects and you can tell the range by its name:
Evas treats its objects equally, so it offers a function set that applies to any Evas object, whichever type that may have. These functions manipulate generic Evas objects:
Some function usage is limited to a certain object type. The following functions can only be used for the objects generated by the
When it comes to Elementary, the UI components are built in a hierarchical fashion. The idea is to factorize as much code as possible between UI components that behave in a similar manner to facilitate the creation of new UI components.
The Elementary UI components inherit a lot of their code from the container UI components and the layout component (a container component that takes a standard Edje design file and wraps it very thinly). You can use the container and layout functions on the Elementary UI components, as well as the Elementary object functions, such as:
A single UI component has its individual API as well. The following functions can only be used for the objects generated by
elm_scroller is a UI component and an implementation of a scrollable interface at the same time. The following functions can be used for all UI components which implement a scrollable interface, such as