Tizen Native API  8.0
Edje Development of External Plugins

Functions to register, unregister EXTERNAL types and develop the plugins.

This group discusses functions useful for the development of new plugins. These functions deal with the newly EXTERNAL types by registering, unregistering and manipulating them.

Functions

Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info)
 Registers a type to be used by EXTERNAL parts.
Eina_Bool edje_external_type_unregister (const char *type_name)
 Unregisters a previously registered EXTERNAL type.
void edje_external_type_array_register (const Edje_External_Type_Info *array)
 Registers a batch of types and their information.
void edje_external_type_array_unregister (const Edje_External_Type_Info *array)
 Unregisters a batch of given external type previously registered.
unsigned int edje_external_type_abi_version_get (void)
 Returns the current ABI version for Edje_External_Type structure.
Eina_Iteratoredje_external_iterator_get (void)
Edje_External_Paramedje_external_param_find (const Eina_List *params, const char *key)
 Convenience function to find a specific parameter in a list of them.
Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret)
 Gets the value of the given parameter of integer type.
Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret)
 Gets the value of the given parameter of double type.
Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret)
 Gets the value of the given parameter of string type.
Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret)
 Gets the value of the given parameter of boolean type.
Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret)
 Gets the value of the given parameter of choice type.
const Edje_External_Param_Infoedje_external_param_info_get (const char *type_name)
 Gets the array of parameters information about a type given its name.
const Edje_External_Typeedje_external_type_get (const char *type_name)
 Gets the Edje_External_Type that defines an EXTERNAL type registered with the name type_name.

Function Documentation

Returns:
An iterator of all the registered EXTERNAL types.

Each item in the iterator is an Eina_Hash_Tuple which has the type of the external in the key and Edje_External_Type as data.

 const Eina_Hash_Tuple *tuple;
 Eina_Iterator *itr;
 const Eina_List *l, *modules;
 const char *s;

 modules = edje_available_modules_get();
 EINA_LIST_FOREACH(modules, l, s)
   {
      if (!edje_module_load(s))
        printf("Error loading edje module: %s\n", s);
   }

 itr = edje_external_iterator_get();
 EINA_ITERATOR_FOREACH(itr, tuple)
   {
      const char *name = tuple->key;
      const Edje_External_Type *type = tuple->data;

      if ((!type) ||
          (type->abi_version != edje_external_type_abi_version_get()))
        {
           printf("Error: invalid type %p (abi: %d, expected: %d)\n",
                   type, type ? type->abi_version : 0,
                   edje_external_type_abi_version_get());
           continue;
        }

      printf("%s: %s (%s) label='%s' desc='%s'\n",
             name, type->module, type->module_name,
             type->label_get ? type->label_get(type->data) : "",
             type->description_get ? type->description_get(type->data) : "");
   }
Since :
3.0
Eina_Bool edje_external_param_bool_get ( const Eina_List params,
const char *  key,
Eina_Bool ret 
)

Gets the value of the given parameter of boolean type.

Look for the key parameter in the params list and return its value in ret. If the parameter is found and is of type EDJE_EXTERNAL_PARAM_TYPE_BOOL, its value will be stored in the Eina_Bool pointed by ret, returning EINA_TRUE. In any other case, the function returns EINA_FALSE.

Parameters:
paramsList of parameters where to look
keyName of the parameter to fetch
retEina_Bool pointer where to store the value, must not be NULL.
Returns:
EINA_TRUE if the parameter was found and is of boolean type, EINA_FALSE otherwise.
Since :
3.0
Eina_Bool edje_external_param_choice_get ( const Eina_List params,
const char *  key,
const char **  ret 
)

Gets the value of the given parameter of choice type.

Look for the key parameter in the params list and return its value in ret. If the parameter is found and is of type EDJE_EXTERNAL_PARAM_TYPE_CHOICE, its value will be stored in the string pointed by ret, returning EINA_TRUE. In any other case, the function returns EINA_FALSE.

The string stored in ret must not be freed or modified.

Parameters:
paramsList of parameters where to look
keyName of the parameter to fetch
retString pointer where to store the value, must not be NULL.
Returns:
EINA_TRUE if the parameter was found and is of integer type, EINA_FALSE otherwise.
Since :
3.0
Eina_Bool edje_external_param_double_get ( const Eina_List params,
const char *  key,
double *  ret 
)

Gets the value of the given parameter of double type.

Look for the key parameter in the params list and return its value in ret. If the parameter is found and is of type EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, its value will be stored in the double pointed by ret, returning EINA_TRUE. In any other case, the function returns EINA_FALSE.

Parameters:
paramsList of parameters where to look
keyName of the parameter to fetch
retDouble pointer where to store the value, must not be NULL.
Returns:
EINA_TRUE if the parameter was found and is of double type, EINA_FALSE otherwise.
Since :
3.0
Edje_External_Param* edje_external_param_find ( const Eina_List params,
const char *  key 
)

Convenience function to find a specific parameter in a list of them.

Parameters:
paramsThe list of parameters for the external
keyThe parameter to look for
Returns:
The matching Edje_External_Param or NULL if it's not found.
Since :
3.0
const Edje_External_Param_Info* edje_external_param_info_get ( const char *  type_name)

Gets the array of parameters information about a type given its name.

Note:
the type names and other strings are static, that means they are NOT translated. One must use Edje_External_Type::translate() to translate those.
Parameters:
type_nameEdje external type name
Returns:
the NULL terminated array, or NULL if type is unknown or it does not have any parameter information.
See also:
edje_external_type_get()
Since :
3.0
Eina_Bool edje_external_param_int_get ( const Eina_List params,
const char *  key,
int *  ret 
)

Gets the value of the given parameter of integer type.

Look for the key parameter in the params list and return its value in ret. If the parameter is found and is of type EDJE_EXTERNAL_PARAM_TYPE_INT, its value will be stored in the int pointed by ret, returning EINA_TRUE. In any other case, the function returns EINA_FALSE.

Parameters:
paramsList of parameters where to look
keyName of the parameter to fetch
retInt pointer where to store the value, must not be NULL.
Returns:
EINA_TRUE if the parameter was found and is of integer type, EINA_FALSE otherwise.
Since :
3.0
Eina_Bool edje_external_param_string_get ( const Eina_List params,
const char *  key,
const char **  ret 
)

Gets the value of the given parameter of string type.

Look for the key parameter in the params list and return its value in ret. If the parameter is found and is of type EDJE_EXTERNAL_PARAM_TYPE_STRING, its value will be stored in the pointer pointed by ret, returning EINA_TRUE. In any other case, the function returns EINA_FALSE.

The string stored in ret must not be freed or modified.

Parameters:
paramsList of parameters where to look
keyName of the parameter to fetch
retString pointer where to store the value, must not be NULL.
Returns:
EINA_TRUE if the parameter was found and is of string type, EINA_FALSE otherwise.
Since :
3.0
unsigned int edje_external_type_abi_version_get ( void  )

Returns the current ABI version for Edje_External_Type structure.

Always check this number before accessing Edje_External_Type in your own software. If the number is not the same, your software may access invalid memory and crash, or just get garbage values.

Warning:
NEVER, EVER define your own Edje_External_Type using the return of this function as it will change as Edje library (libedje.so) changes, but your type definition will not. Instead, use EDJE_EXTERNAL_TYPE_ABI_VERSION.

Summary:

Returns:
The external ABI version the Edje library was compiled with. That is, the value EDJE_EXTERNAL_TYPE_ABI_VERSION had at that moment.
Since :
3.0

Registers a batch of types and their information.

When several types will be registered it is recommended to use this function instead of several calls to edje_external_type_register(), as it is faster.

Note:
The contents of the array will be referenced directly for as long as the type remains registered, so both the name and info in the array must be kept alive during all this period (usually, the entire program lifetime). The most common case would be to keep the array as a static const type anyway.
Parameters:
arrayNULL terminated array with type name and information. Note that type name or information are referenced directly, so they must be kept alive after this function returns!
Returns:
EINA_TRUE on success, EINA_FALSE on failure (like type already registered).
See also:
edje_external_type_register()
Since :
3.0

Unregisters a batch of given external type previously registered.

Parameters:
arrayNULL terminated array, should be the same as the one used to register with edje_external_type_array_register()
See also:
edje_external_type_unregister()
Since :
3.0
const Edje_External_Type* edje_external_type_get ( const char *  type_name)

Gets the Edje_External_Type that defines an EXTERNAL type registered with the name type_name.

Since :
3.0
Eina_Bool edje_external_type_register ( const char *  type_name,
const Edje_External_Type type_info 
)

Registers a type to be used by EXTERNAL parts.

Parts of type EXTERNAL will call user defined functions to create and manipulate the object that's allocated in that part. This is done by expecifying in the source property of the part the name of the external to use, which must be one registered with this function.

Parameters:
type_nameName to register and be known by edje's "source:" parameter of "type: EXTERNAL" parts.
type_infoMeta-information describing how to interact with it.
Returns:
EINA_TRUE on success, EINA_FALSE on failure (like type already registered).
See also:
edje_external_type_array_register()
Since :
3.0
Eina_Bool edje_external_type_unregister ( const char *  type_name)

Unregisters a previously registered EXTERNAL type.

Parameters:
type_namename to unregister. It should have been registered with edje_external_type_register() before.
Returns:
EINA_TRUE on success, EINA_FALSE on failure (like type_name did not exist).
See also:
edje_external_type_array_unregister()
Since :
3.0