Tizen Native API
Edje File

This group discusses functions to deal with EDJ files.

Remarks:
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 an edje object.
This group of functions interacts with these EDJ files, either by loading them or retrieving information from the EDC file about objects.

Functions

char * edje_file_data_get (const char *file, const char *key)
 Gets data from the file level data block of an edje file.
Eina_Listedje_file_collection_list (const char *file)
 Gets the list of groups in an edje file.
void edje_file_collection_list_free (Eina_List *lst)
 Frees the file collection list.
Eina_Bool edje_file_group_exists (const char *file, const char *glob)
 Checks whether a group matching glob exists in an edje file.
Eina_Bool edje_object_file_set (Evas_Object *obj, const char *file, const char *group)
 Sets the EDJ file (and group within it) from which to load an edje object's contents.
void edje_object_file_get (const Evas_Object *obj, const char **file, const char **group)
 Gets the file and group name that a given edje object is bound to.
const char * edje_object_data_get (const Evas_Object *obj, const char *key)
 Gets an EDC data field value from a given Edje object group.
Edje_Load_Error edje_object_load_error_get (const Evas_Object *obj)
 Gets the (last) file loading error for a given edje object.
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.

Typedefs

typedef enum _Edje_Load_Error Edje_Load_Error
 Edje Load Error Type.

Typedef Documentation

Edje Load Error Type.

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


Enumeration Type Documentation

Edje Load Error Type.

Enumerator:
EDJE_LOAD_ERROR_NONE 

No error occurred, the loading is successful

EDJE_LOAD_ERROR_GENERIC 

A generic error occurred during loading

EDJE_LOAD_ERROR_DOES_NOT_EXIST 

The file being pointed to does not exist

EDJE_LOAD_ERROR_PERMISSION_DENIED 

Permission to read the given file has been denied

EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED 

Resource allocation failed during loading

EDJE_LOAD_ERROR_CORRUPT_FILE 

The file being pointed to is corrupt

EDJE_LOAD_ERROR_UNKNOWN_FORMAT 

The file being pointed to has an unknown format

EDJE_LOAD_ERROR_INCOMPATIBLE_FILE 

The file being pointed to is incompatible, i.e., it doesn't match the library's current version format

EDJE_LOAD_ERROR_UNKNOWN_COLLECTION 

The group/collection set to load from is 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_file_collection_list ( const char *  file)

Gets the list of groups in an edje file.

Since :
2.3.1
Remarks:
The list must be freed using edje_file_collection_list_free() when you are done with it.
Parameters:
[in]fileThe path to the edje file
Returns:
An Eina_List of group names (char *)

Frees the file collection list.

This frees the list returned by edje_file_collection_list().

Parameters:
[in]lstAn Eina_List of groups
Since :
2.3.1
char* edje_file_data_get ( const char *  file,
const char *  key 
)

Gets data from the file level data block of an edje file.

Since :
2.3.1
Remarks:
If an edje file is built from the following edc:

data { item: "key1" "value1"; item: "key2" "value2"; } collections { ... }

Then, edje_file_data_get("key1") returns "value1".

Parameters:
[in]fileThe path to the .edj file
[in]keyThe data key
Returns:
The string value of the data, must be freed by the user when no longer needed
Eina_Bool edje_file_group_exists ( const char *  file,
const char *  glob 
)

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

Since :
2.3.1
Parameters:
[in]fileThe file path
[in]globThe glob to match with
Returns:
1 if a match is found, otherwise 0
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.

Since :
2.3.1
Remarks:
edje_object_file_set() is a function that sets an error value later, 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.
Parameters:
[in]errorThe error code, a value in Edje_Load_Error
Returns:
A valid string
If the given error is not supported, "Unknown error" is returned.
const char* edje_object_data_get ( const Evas_Object obj,
const char *  key 
)

Gets an EDC data field value from a given Edje object group.

This function fetches an EDC data field value, which is declared on the object's 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.

Since :
2.3.1

They look like the following:

 collections {
   group {
     name: "a_group";
     data {
     item: "key1" "value1";
     item: "key2" "value2";
     }
   }
 }
Remarks:
EDC data fields always hold strings as values, hence the return type of this function. Check the complete syntax reference for EDC files.
Do not confuse this call with edje_file_data_get(), which queries for a global EDC data field on an EDC declaration file.
Parameters:
[in]objA handle to an edje object
[in]keyThe data field key string
Returns:
The data value string, must not be freed
See also:
edje_object_file_set()
void edje_object_file_get ( const Evas_Object obj,
const char **  file,
const char **  group 
)

Gets the file and group name that a given edje object is bound to.

Since :
2.3.1
Remarks:
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 are set to NULL, indicating an error.
Use NULL pointers on the file/group components you're not interested in, they are ignored by the function.
Parameters:
[in]objA handle to an edje object
[out]fileA pointer to a variable to store the file path
[out]groupA pointer to a variable to store the group name
See also:
edje_object_file_set()
Eina_Bool edje_object_file_set ( Evas_Object obj,
const char *  file,
const char *  group 
)

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

Since :
2.3.1
Remarks:
Edje expects EDJ files, which are theming objects' descriptions and resources packed together in an EET file, to read edje object definitions from. They are usually 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 into a single 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 it life", by telling it from where it can get its contents.
Parameters:
[in]objA handle to an edje object
[in]fileThe path to the EDJ file to load from
[in]groupThe name of the group, in file, which implements an edje object
Returns:
EINA_TRUE on success otherwise EINA_FALSE on errors (check edje_object_load_error_get() after this call to get errors causes)
See also:
edje_object_add()
edje_object_file_get()

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

This function is meant to be used after an edje EDJ file load that 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.

Since :
2.3.1
Parameters:
[in]objA handle to an edje object
Returns:
The Edje loading error, one from:
See also:
edje_load_error_str()