Macros | |
#define | elm_layout_icon_set(_ly, _obj) |
Convenience macro to set the icon object in a layout that follows the Elementary naming convention for its parts. | |
#define | elm_layout_icon_get(_ly) elm_layout_content_get((_ly), "elm.swallow.icon") |
Convenience macro to get the icon object from a layout that follows the Elementary naming convention for its parts. | |
#define | elm_layout_end_set(_ly, _obj) |
Convenience macro to set the end object in a layout that follows the Elementary naming convention for its parts. | |
#define | elm_layout_end_get(_ly) elm_layout_content_get((_ly), "elm.swallow.end") |
Convenience macro to get the end object in a layout that follows the Elementary naming convention for its parts. | |
Typedefs | |
typedef struct _Elm_Layout_Part_Alias_Description | Elm_Layout_Part_Alias_Description |
A layout part aliasing (proxying) description, used to get part names aliasing independently of a widgets theme. | |
Functions | |
Evas_Object * | elm_layout_add (Evas_Object *parent) |
Add a new layout to the parent. More... | |
Eina_List * | elm_layout_content_swallow_list_get (const Evas_Object *obj) |
Get the list of swallow parts of a given container widget. More... | |
Eina_Bool | elm_layout_content_set (Evas_Object *obj, const char *swallow, Evas_Object *content) |
Set the layout content. More... | |
Evas_Object * | elm_layout_content_get (const Evas_Object *obj, const char *swallow) |
Get the child object in the given content part. More... | |
Evas_Object * | elm_layout_content_unset (Evas_Object *obj, const char *swallow) |
Unset the layout content. More... | |
Eina_Bool | elm_layout_file_set (Eo *obj, const char *file, const char *group) |
Set the file that will be used as layout. More... | |
void | elm_layout_file_get (Eo *obj, const char **file, const char **group) |
Get the loaded file. More... | |
A Layout is a direct realization of The Elementary Layout Class.
This is a container widget that takes a standard Edje design file and wraps it very thinly in a widget.
An Edje design (theme) file has a very wide range of possibilities to describe the behavior of elements forming a layout. Check out the Edje documentation and the EDC reference to get more information about what can be done with Edje.
Just like List, Box, and other container widgets, any object added to the Layout will become its child, meaning that it will be deleted if the Layout is deleted, moved if the Layout is moved, and so on.
The layout widget may contain as many parts/children as described in its theme file. Some of these children can have special types, such as content holder ones (swallow spots), boxes or tables. These are parts meant to contain others. For instance, objects can be added to different table parts by specifying the respective table part names. The same is valid for swallows and boxes.
The objects added as children of a layout will behave as described in the part description where they were added. There are 3 possible types of parts where a child can be added:
Only one object can be added to the SWALLOW
part at a time (but you still can have many SWALLOW
parts and one object on each of them). Use the elm_layout_content_set()/get/unset
functions to set, retrieve and unset objects as content of the SWALLOW
. After being set to this part, the object's size, position, visibility, clipping and other description properties will be totally controlled by the description of the given part (inside the Edje theme file).
One can use evas_object_size_hint_*
functions on the child to have some kind of control over its behavior, but the resulting behavior will still depend heavily on the SWALLOW
part's description.
The Edje theme also can change the part description, based on signals or scripts running inside the theme. This change can also be animated. All of this will affect the child object set as content accordingly. The object's size will be changed if the part size is changed, it will animate moving accordingly if the part is moving, and so on.
The following picture demonstrates a layout widget with a child object added to its SWALLOW:
An Edje BOX
part is very similar to the Elementary Box widget. It allows one to add objects to the box and have them distributed along its area, accordingly to the specified layout
property (now by layout
we mean the chosen layouting design of the Box, not the layout widget itself).
A similar effect for having a box with its position, size and other things controlled by the layout theme would be to create an Elementary Box widget and add it as content in a SWALLOW
part.
The main difference to that, by using the layout box instead, is that its behavior, like layouting format, padding, align, etc., will all be controlled by the theme. This means, for example, that a signal could be sent to the layout's theme (with elm_layout_signal_emit()) and the signal be handled by changing the box's padding, or alignment, or both. Using the Elementary Box widget is not necessarily harder or easier, it just depends on the circumstances and requirements.
The layout box can be used through the elm_layout_box_*
set of functions.
The following picture demonstrates a Layout widget with many child objects added to its BOX
part:
Just like the Box (BOX
part), the layout table is very similar to the Elementary Table widget. It allows one to add objects to the table by specifying the row and column where the object should be added, and any column or row span, if necessary.
Again, we could have this design by adding a table widget to a SWALLOW
part, using elm_layout_content_set(). The same difference happens here when choosing to use the layout table (a TABLE
part) instead of the table in a SWALLOW
part. It's just a matter of convenience.
The layout table can be used through the elm_layout_table_*
set of functions.
The following picture demonstrates a layout widget with many child objects added to its TABLE
part:
Another interesting thing about the layout widget is that it offers some predefined themes that come with the default Elementary theme. These themes can be set by the call elm_layout_theme_set(), and provide some basic functionality depending on the theme used.
Most of them already send some signals, some already provide a toolbar or back and next buttons.
These are the available predefined theme layouts. All of them have class = layout
, group = application
, and style = one of the following options:
toolbar-content
- for applications with a toolbar and main content area toolbar-content-back
- for applications with a toolbar and main content (with a back button) and title areas toolbar-content-back-next
- for applications with a toolbar and main content (with back and next buttons) and title areas content-back
- for application with main content (with a back button) and title areas content-back-next
- for applications with main content (with back and next buttons) and title areas toolbar-vbox
- for applications with a toolbar and main content area as a vertical box toolbar-table
- for applications with a toolbar and main content area as a tableThis widget emits the following signals:
Some examples of the Layout widget can be found here:
Evas_Object* elm_layout_add | ( | Evas_Object * | parent | ) |
Add a new layout to the parent.
parent | The parent object |
Referenced by elm_color_class_editor_add().
Evas_Object* elm_layout_content_get | ( | const Evas_Object * | obj, |
const char * | swallow | ||
) |
Get the child object in the given content part.
obj | The layout object |
swallow | The SWALLOW part to get its content |
Eina_Bool elm_layout_content_set | ( | Evas_Object * | obj, |
const char * | swallow, | ||
Evas_Object * | content | ||
) |
Set the layout content.
obj | The layout object |
swallow | The swallow part name in the edje file |
content | The child that will be added in this layout object |
EINA_TRUE
on success, EINA_FALSE
otherwiseOnce the content object is set, a previously set one will be deleted. If you want to keep that old content object, use the elm_layout_content_unset() function.
SWALLOW
. This is why the parameter name is called swallow
, but it is expected to be a part name just like the second parameter of elm_layout_box_append().BOX
part) Eina_List* elm_layout_content_swallow_list_get | ( | const Evas_Object * | obj | ) |
Get the list of swallow parts of a given container widget.
obj | The layout object |
Evas_Object* elm_layout_content_unset | ( | Evas_Object * | obj, |
const char * | swallow | ||
) |
Unset the layout content.
obj | The layout object |
swallow | The swallow part name in the edje file |
Unparent and return the content object which was set for this part.
void elm_layout_file_get | ( | Eo * | obj, |
const char ** | file, | ||
const char ** | group | ||
) |
Get the loaded file.
file | The path to file (edj) used as layout |
group | The group that the layout belongs in edje file |
Eina_Bool elm_layout_file_set | ( | Eo * | obj, |
const char * | file, | ||
const char * | group | ||
) |
Set the file that will be used as layout.
[in] | file | The path to file (edj) that will be used as layout |
[in] | group | The group that the layout belongs in edje file |