Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Type


Data Structures

struct  Etk_Type
 The type of an Etk_Object: it can have a constructor and a destructor and can inherit from another Etk_Type
It also has a list of properties that will describe the state of the instanciated object. More...

Defines

#define ETK_CONSTRUCTOR(constructor)   ((Etk_Constructor)(constructor))
#define ETK_DESTRUCTOR(destructor)   ((Etk_Destructor)(destructor))

Functions

void etk_type_shutdown (void)
 Deletes all the created types.
Etk_Type * etk_type_new (const char *type_name, Etk_Type *parent_type, int type_size, Etk_Constructor constructor, Etk_Destructor destructor)
 Creates a new type. Will be automatically deleted with the etk_type_shutdown() call.
void etk_type_delete (Etk_Type *type)
 Deletes the type.
void etk_type_object_construct (Etk_Type *type, Etk_Object *object)
 Calls the constructors of the object, from the constructor of the root parent type up to the one of the object type.
void etk_type_destructors_call (Etk_Type *type, Etk_Object *object)
 Calls the destructors of the object, from the destructor of the object type up to the one of the root parent type.
Etk_Bool etk_type_inherits_from (Etk_Type *type, Etk_Type *parent)
 Checks if the type inherits from the parent type.
Etk_Type * etk_type_parent_type_get (Etk_Type *type)
 Gets the parent type of the type type.
const char * etk_type_name_get (Etk_Type *type)
 Gets the name of the type.
void etk_type_signal_add (Etk_Type *type, Etk_Signal *signal)
 Adds a signal associated to the type.
void etk_type_signal_remove (Etk_Type *type, Etk_Signal *signal)
 Removes the signal from the list of signals of the type.
Etk_Signal * etk_type_signal_get (Etk_Type *type, const char *signal_name)
 Gets the signal corresponding to the type and the signal name.
Etk_Property * etk_type_property_add (Etk_Type *type, const char *name, int property_id, Etk_Property_Type property_type, Etk_Property_Flags flags, Etk_Property_Value *default_value)
 Adds a new property to the type.
Etk_Bool etk_type_property_find (Etk_Type *type, const char *name, Etk_Type **property_owner, Etk_Property **property)
 Finds the property called name in the type type.
void etk_type_property_list (Etk_Type *type, Evas_List **properties)
 Lists the properties of the type and appends them to properties.


Define Documentation

#define ETK_CONSTRUCTOR ( constructor   )     ((Etk_Constructor)(constructor))

Casts the function pointer to an Etk_Constructor

#define ETK_DESTRUCTOR ( destructor   )     ((Etk_Destructor)(destructor))

Casts the function pointer to an Etk_Constructor


Function Documentation

void etk_type_shutdown ( void   ) 

Deletes all the created types.

Warning:
Shouldn't be called manually, etk_shutdown() calls it

Etk_Type * etk_type_new ( const char *  type_name,
Etk_Type *  parent_type,
int  type_size,
Etk_Constructor  constructor,
Etk_Destructor  destructor 
)

Creates a new type. Will be automatically deleted with the etk_type_shutdown() call.

Parameters:
type_name the name of the new type
parent_type the type whom the new type inherits from (NULL if the new type is a root type)
type_size the size of an instance
constructor the constructor function
destructor the destructor function
Returns:
Returns the new type on success, NULL on failure

void etk_type_delete ( Etk_Type *  type  ) 

Deletes the type.

Parameters:
type the type to delete
Warning:
Use it at your own risk you can safely call it only if all the objects of derivating type are already destroyed

void etk_type_object_construct ( Etk_Type *  type,
Etk_Object *  object 
)

Calls the constructors of the object, from the constructor of the root parent type up to the one of the object type.

Parameters:
type the type of the object
object the object that will be passed as argument to the constructor

void etk_type_destructors_call ( Etk_Type *  type,
Etk_Object *  object 
)

Calls the destructors of the object, from the destructor of the object type up to the one of the root parent type.

Parameters:
type the type of the object
object the object that will be passed as argument to the destructor

Etk_Bool etk_type_inherits_from ( Etk_Type *  type,
Etk_Type *  parent 
)

Checks if the type inherits from the parent type.

Parameters:
type the type we check on
parent the parent type we check on
Returns:
Returns ETK_TRUE if type inerits from parent, ETK_FALSE otherwise

Etk_Type * etk_type_parent_type_get ( Etk_Type *  type  ) 

Gets the parent type of the type type.

Parameters:
type the type we want the parent type
Returns:
Returns the parent type of the type type or NULL if type doesn't inherit from another type

const char * etk_type_name_get ( Etk_Type *  type  ) 

Gets the name of the type.

Parameters:
type a type
Returns:
Returns the name of the type, or NULL on failure

void etk_type_signal_add ( Etk_Type *  type,
Etk_Signal *  signal 
)

Adds a signal associated to the type.

Parameters:
type the type to add the signal to
signal the signal to add

void etk_type_signal_remove ( Etk_Type *  type,
Etk_Signal *  signal 
)

Removes the signal from the list of signals of the type.

Parameters:
type the type that is associated to the signal to remove
signal the signal to remove

Etk_Signal * etk_type_signal_get ( Etk_Type *  type,
const char *  signal_name 
)

Gets the signal corresponding to the type and the signal name.

Parameters:
type the type that is associated to the signal to get
signal_name the name of the signal to get
Returns:
Returns the signal corresponding to the type and the signal name, or NULL on failure

Etk_Property * etk_type_property_add ( Etk_Type *  type,
const char *  name,
int  property_id,
Etk_Property_Type  property_type,
Etk_Property_Flags  flags,
Etk_Property_Value *  default_value 
)

Adds a new property to the type.

Parameters:
type the type to add the property to
name the name of the new property
property_id the id you want to associate to the property
property_type the type of the property
flags describes if the property value should be writable (ETK_PROPERTY_WRITABLE), readable (ETK_PROPERTY_READABLE) or both (ETK_PROPERTY_WRITABLE | ETK_PROPERTY_READABLE)
default_value the default value of the property
Returns:
Returns the new property on success, or NULL on failure

Etk_Bool etk_type_property_find ( Etk_Type *  type,
const char *  name,
Etk_Type **  property_owner,
Etk_Property **  property 
)

Finds the property called name in the type type.

Parameters:
type the type that has the property
name the name of the property to find
property_owner the location where the type that has the property should be return (it can be a child type of type)
property the location where the property should be return
Returns:
Returns ETK_TRUE if the property has been found, ETK_FALSE on failure (if the type doesn't have a property of that name)

void etk_type_property_list ( Etk_Type *  type,
Evas_List **  properties 
)

Lists the properties of the type and appends them to properties.

Parameters:
type the type that has the properties to list
properties the location of the list where the properties will be appended