- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Typedefs | Enumerations | Functions
Edje Object File
Edje Object

Functions to deals with EDJ files. More...

## Typedefs
typedef enum _Edje_Load_Error | Edje_Load_Error
| Edje file loading error codes one can get - see edje_load_error_str() too. More...

## Enumerations
enum | _Edje_Load_Error { EDJE_LOAD_ERROR_NONE = 0, EDJE_LOAD_ERROR_GENERIC = 1, EDJE_LOAD_ERROR_DOES_NOT_EXIST = 2, EDJE_LOAD_ERROR_PERMISSION_DENIED = 3, EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, EDJE_LOAD_ERROR_CORRUPT_FILE = 5, EDJE_LOAD_ERROR_UNKNOWN_FORMAT = 6, EDJE_LOAD_ERROR_INCOMPATIBLE_FILE = 7, EDJE_LOAD_ERROR_UNKNOWN_COLLECTION = 8, EDJE_LOAD_ERROR_RECURSIVE_REFERENCE = 9 }

## Functions
Eina_List * | edje_mmap_collection_list (Eina_File *f)
| Get a list of groups in an edje mapped file. More...
void | edje_mmap_collection_list_free (Eina_List *lst)
| Free file collection list. More...
Eina_Bool | edje_mmap_group_exists (Eina_File *f, const char *glob)
| Determine whether a group matching glob exists in an edje mapped file. More...
Eina_List * | edje_file_collection_list (const char *file)
| Get a list of groups in an edje file. More...
void | edje_file_collection_list_free (Eina_List *lst)
| Free file collection list. More...
Eina_Bool | edje_file_group_exists (const char *file, const char *glob)
| Determine whether a group matching glob exists in an edje file. More...
const char * | edje_load_error_str (Edje_Load_Error error)
| Converts the given Edje file load error code into a string describing it in English. More...
#define | edje_obj_data_get(key, ret) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(const char **, ret)
| Retrieve an EDC data field's value from a given Edje. More...
#define | edje_obj_file_set(file, group, ret) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_FILE_SET), EO_TYPECHECK(const char*, file), EO_TYPECHECK(const char *, group), EO_TYPECHECK(Eina_Bool *, ret)
#define | edje_obj_mmap_set(file, group, ret) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_MMAP_SET), EO_TYPECHECK(const Eina_File*, file), EO_TYPECHECK(const char *, group), EO_TYPECHECK(Eina_Bool *, ret)
#define | edje_obj_file_get(file, group) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_FILE_GET), EO_TYPECHECK(const char **, file), EO_TYPECHECK(const char **, group)
| Get the file and group name that a given Edje object is bound to. More...
#define | edje_obj_load_error_get(ret) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_LOAD_ERROR_GET), EO_TYPECHECK(Edje_Load_Error *, ret)
| Gets the (last) file loading error for a given Edje object. More...
const char * | edje_object_data_get (const Evas_Object *obj, const char *key)
| Retrive an EDC data field's value from a given Edje object's group. More...
Eina_Bool | edje_object_file_set (Evas_Object *obj, const char *file, const char *group)
| Sets the EDJ file (and group within it) to load an Edje object's contents from. More...
Eina_Bool | edje_object_mmap_set (Evas_Object *obj, const Eina_File *file, const char *group)
| Sets the EDJ file (and group within it) to load an Edje object's contents from. More...
void | edje_object_file_get (const Evas_Object *obj, const char **file, const char **group)
| Get the file and group name that a given Edje object is bound to. More...
Edje_Load_Error | edje_object_load_error_get (const Evas_Object *obj)
| Gets the (last) file loading error for a given Edje object. More...

## Detailed Description

Functions to deals with EDJ files.

Layouts in Edje are usually called themes and they are created using the EDC language. The EDC language is declarative and must be compiled before being used. The output of this compilation is an EDJ file, this file can be loaded by Edje, and the result is a edje object.

This groups of functions interact with these EDJ files, either by loading them or retrieving information of the EDC file about objects.

## Macro Definition Documentation

#define edje_obj_data_get | ( |  | key,
|  |  | ret
| ) |  | EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(const char **, ret)

Retrieve an EDC data field's value from a given Edje.

Since
  1.8

Parameters

  [in] | key |
  [out] | ret |

See Also
  edje_object_data_get

Referenced by edje_object_data_get().

#define edje_obj_file_set | ( |  | file,
|  |  | group,
|  |  | ret
| ) |  | EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_FILE_SET), EO_TYPECHECK(const char*, file), EO_TYPECHECK(const char *, group), EO_TYPECHECK(Eina_Bool *, ret)

Since
  1.8

Parameters

  [in] | file | in
  [in] | group | in
  [out] | ret | out

See Also
  edje_object_file_set

Referenced by edje_object_file_set().

#define edje_obj_mmap_set | ( |  | file,
|  |  | group,
|  |  | ret
| ) |  | EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_MMAP_SET), EO_TYPECHECK(const Eina_File*, file), EO_TYPECHECK(const char *, group), EO_TYPECHECK(Eina_Bool *, ret)

Since
  1.8

Parameters

  [in] | file | in
  [in] | group | in
  [out] | ret | out

See Also
  edje_object_file_set

Referenced by edje_object_mmap_set().

#define edje_obj_file_get | ( |  | file,
|  |  | group
| ) |  | EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_FILE_GET), EO_TYPECHECK(const char **, file), EO_TYPECHECK(const char **, group)

Get the file and group name that a given Edje object is bound to.

Since
  1.8

Parameters

  [out] | file |
  [out] | group |

See Also
  edje_object_file_get

Referenced by edje_object_file_get().

#define edje_obj_load_error_get | ( |  | ret | ) | EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_LOAD_ERROR_GET), EO_TYPECHECK(Edje_Load_Error *, ret)

Gets the (last) file loading error for a given Edje object.

Since
  1.8

Parameters

  [out] | ret |

See Also
  edje_object_load_error_get

Referenced by edje_object_load_error_get().

## Typedef Documentation

typedef enum _Edje_Load_Error Edje_Load_Error

Edje file loading error codes one can get - see edje_load_error_str() too.

## Enumeration Type Documentation

enum _Edje_Load_Error

Enumerator
EDJE_LOAD_ERROR_NONE | No error happened, the loading was successful.
EDJE_LOAD_ERROR_GENERIC | A generic error happened during the loading.
EDJE_LOAD_ERROR_DOES_NOT_EXIST | The file pointed to did not exist.
EDJE_LOAD_ERROR_PERMISSION_DENIED | Permission to read the given file was denied.
EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED | Resource allocation failed during the loading.
EDJE_LOAD_ERROR_CORRUPT_FILE | The file pointed to was corrupt.
EDJE_LOAD_ERROR_UNKNOWN_FORMAT | The file pointed to had an unknown format.
EDJE_LOAD_ERROR_INCOMPATIBLE_FILE | The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.
EDJE_LOAD_ERROR_UNKNOWN_COLLECTION | The group/collection set to load from was not found in the file.
EDJE_LOAD_ERROR_RECURSIVE_REFERENCE | The group/collection set to load from had recursive references on its components.

## Function Documentation

Eina_List* edje_mmap_collection_list | ( | Eina_File * | f | ) |

Get a list of groups in an edje mapped file.

Parameters

  f | The mapped file

Returns
  The Eina_List of group names (char *)

Note: the list must be freed using edje_mmap_collection_list_free() when you are done with it.

References eina_hash_iterator_key_new(), EINA_ITERATOR_FOREACH, eina_iterator_free(), eina_list_append(), and eina_stringshare_add().

Referenced by edje_file_collection_list().

void edje_mmap_collection_list_free | ( | Eina_List * | lst | ) |

Free file collection list.

Parameters

  lst | The Eina_List of groups

Frees the list returned by edje_mmap_collection_list().

References edje_file_collection_list_free().

Eina_Bool edje_mmap_group_exists | ( | Eina_File * | f,
|  | const char * | glob
| ) |  |

Determine whether a group matching glob exists in an edje mapped file.

Parameters

  f | The mapped file
  glob | A glob to match on

Returns
  1 if a match is found, 0 otherwise

References EINA_FALSE, eina_file_filename_get(), eina_hash_find(), eina_hash_iterator_data_new(), EINA_ITERATOR_FOREACH, eina_iterator_free(), eina_list_append(), eina_list_free(), and EINA_TRUE.

Referenced by edje_file_group_exists().

Eina_List* edje_file_collection_list | ( | const char * | file | ) |

Get a list of groups in an edje file.

Parameters

  file | The path to the edje file

Returns
  The Eina_List of group names (char *)

See Also
  edje_mmap_collection_list()

Note: the list must be freed using edje_file_collection_list_free() when you are done with it.

See Also
  edje_mmap_group_exists()

References edje_mmap_collection_list(), EINA_FALSE, eina_file_close(), and eina_file_open().

void edje_file_collection_list_free | ( | Eina_List * | lst | ) |

Free file collection list.

Parameters

  lst | The Eina_List of groups

Frees the list returned by edje_file_collection_list().

References eina_list_data_get(), eina_list_remove(), and eina_stringshare_del().

Referenced by edje_mmap_collection_list_free().

Eina_Bool edje_file_group_exists | ( | const char * | file,
|  | const char * | glob
| ) |  |

Determine whether a group matching glob exists in an edje file.

Parameters

  file | The file path
  glob | A glob to match on

Returns
  1 if a match is found, 0 otherwise

References edje_mmap_group_exists(), EINA_FALSE, eina_file_close(), and eina_file_open().

const char* edje_load_error_str | ( | Edje_Load_Error | error | ) |

Converts the given Edje file load error code into a string describing it in English.

Parameters

  error | the error code, a value in Edje_Load_Error.

Returns
  Always returns a valid string. If the given `error` is not supported, `"Unknown error"` is returned.

edje_object_file_set() is a function which sets an error value, afterwards, which can be fetched with edje_object_load_error_get(). The function in question is meant to be used in conjunction with the latter, for pretty-printing any possible error cause.

Examples:
  edje-basic.c, edje-signals-messages.c, and evas-aspect-hints.c.

References EDJE_LOAD_ERROR_CORRUPT_FILE, EDJE_LOAD_ERROR_DOES_NOT_EXIST, EDJE_LOAD_ERROR_GENERIC, EDJE_LOAD_ERROR_INCOMPATIBLE_FILE, EDJE_LOAD_ERROR_NONE, EDJE_LOAD_ERROR_PERMISSION_DENIED, EDJE_LOAD_ERROR_RECURSIVE_REFERENCE, EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED, EDJE_LOAD_ERROR_UNKNOWN_COLLECTION, and EDJE_LOAD_ERROR_UNKNOWN_FORMAT.

const char* edje_object_data_get | ( | const Evas_Object * | obj,
|  | const char * | key
| ) |  |

Retrive an EDC data field's value from a given Edje object's group.

Parameters

  obj | A handle to an Edje object
  key | The data field's key string

Returns
  The data's value string. Must not be freed.

This function fetches an EDC data field's value, which is declared on the objects building EDC file, under its group. EDC data blocks are most commonly used to pass arbitrary parameters from an application's theme to its code.

They look like the following:

collections {
group {
name: "a_group";
data {
item: "key1" "value1";
item: "key2" "value2";
}
}
}

EDC data fields always hold strings as values, hence the return type of this function. Check the complete syntax reference for EDC files.

Warning
  Do not confuse this call with edje_file_data_get(), which queries for a global EDC data field on an EDC declaration file.

See Also
  edje_object_file_set()

Examples:
  edje-basic.c.

References edje_obj_data_get.

Eina_Bool edje_object_file_set | ( | Evas_Object * | obj,
|  | const char * | file,
|  | const char * | group
| ) |  |

Sets the EDJ file (and group within it) to load an Edje object's contents from.

Parameters

  obj | A handle to an Edje object
  file | The path to the EDJ file to load `from`
  group | The name of the group, in `file`, which implements an Edje object

Returns
  `EINA_TRUE`, on success or `EINA_FALSE`, on errors (check edje_object_load_error_get() after this call to get errors causes)

Edje expects EDJ files, which are theming objects' descriptions and resources packed together in an EET file, to read Edje object definitions from. They usually are created with the ``.edj extension. EDJ files, in turn, are assembled from textual object description files, where one describes Edje objects declaratively – the EDC files (see the syntax for those files).

Those description files were designed so that many Edje object definitions – also called groups (or collections) – could be packed together in the same EDJ file, so that a whole application's theme could be packed in one file only. This is the reason for the `group` argument.

Use this function after you instantiate a new Edje object, so that you can "give him life", telling where to get its contents from.

See Also
  edje_object_add()
  edje_object_file_get()
  edje_object_mmap_set()

Examples:
  edje-basic.c, edje-box.c, edje-box2.c, edje-color-class.c, edje-drag.c, edje-perspective.c, edje-signals-messages.c, edje-swallow.c, edje-table.c, edje-text.c, and evas-aspect-hints.c.

References edje_obj_file_set, and EINA_FALSE.

Referenced by edje_edit_part_source_set().

Eina_Bool edje_object_mmap_set | ( | Evas_Object * | obj,
|  | const Eina_File * | file,
|  | const char * | group
| ) |  |

Sets the EDJ file (and group within it) to load an Edje object's contents from.

Parameters

  obj | A handle to an Edje object
  file | The Eina_File pointing to the EDJ file to load `from`
  group | The name of the group, in `file`, which implements an Edje object

Returns
  `EINA_TRUE`, on success or `EINA_FALSE`, on errors (check edje_object_load_error_get() after this call to get errors causes)

Edje expects EDJ files, which are theming objects' descriptions and resources packed together in an EET file, to read Edje object definitions from. They usually are created with the ``.edj extension. EDJ files, in turn, are assembled from textual object description files, where one describes Edje objects declaratively – the EDC files (see the syntax for those files).

Those description files were designed so that many Edje object definitions – also called groups (or collections) – could be packed together in the same EDJ file, so that a whole application's theme could be packed in one file only. This is the reason for the `group` argument.

Use this function after you instantiate a new Edje object, so that you can "give him life", telling where to get its contents from.

See Also
  edje_object_add()
  edje_object_file_get()
  edje_object_mmap_set()

Since
  1.8

References edje_obj_mmap_set, and EINA_FALSE.

void edje_object_file_get | ( | const Evas_Object * | obj,
|  | const char ** | file,
|  | const char ** | group
| ) |  |

Get the file and group name that a given Edje object is bound to.

Parameters

  obj | A handle to an Edje object
  file | A pointer to a variable whero to store the file's path
  group | A pointer to a variable where to store the group name in

This gets the EDJ file's path, with the respective group set for the given Edje object. If obj is either not an Edje file, or has not had its file/group set previously, by edje_object_file_set(), then both `file` and `group` will be set to `NULL`, indicating an error.

See Also
  edje_object_file_set()

Note
  Use `NULL` pointers on the file/group components you're not interested in: they'll be ignored by the function.

References edje_obj_file_get.

Edje_Load_Error edje_object_load_error_get | ( | const Evas_Object * | obj | ) |

Gets the (last) file loading error for a given Edje object.

Parameters

  obj | A handlet to an Edje object

Returns
  The Edje loading error, one of:
  - EDJE_LOAD_ERROR_NONE
  - EDJE_LOAD_ERROR_GENERIC
  - EDJE_LOAD_ERROR_DOES_NOT_EXIST
  - EDJE_LOAD_ERROR_PERMISSION_DENIED
  - EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED
  - EDJE_LOAD_ERROR_CORRUPT_FILE
  - EDJE_LOAD_ERROR_UNKNOWN_FORMAT
  - EDJE_LOAD_ERROR_INCOMPATIBLE_FILE
  - EDJE_LOAD_ERROR_UNKNOWN_COLLECTION
  - EDJE_LOAD_ERROR_RECURSIVE_REFERENCE

This function is meant to be used after an Edje EDJ file loading, what takes place with the edje_object_file_set() function. If that function does not return `EINA_TRUE`, one should check for the reason of failure with this one.

See Also
  edje_load_error_str()

Examples:
  edje-basic.c, edje-signals-messages.c, and evas-aspect-hints.c.

References EDJE_LOAD_ERROR_NONE, and edje_obj_load_error_get.