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, const Etk_Signal_Description *signals)
 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.
Etk_Type * etk_type_get_from_name (const char *name)
 Gets the Etk_Type from the type's name.
Etk_Signal * etk_type_signal_get_by_name (Etk_Type *type, const char *signal_name)
 Gets the signal corresponding to the type and the signal name.
Etk_Signal * etk_type_signal_get (Etk_Type *type, int signal_code)
 Gets the signal corresponding to the type and the signal code.
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

Referenced by etk_tool_button_type_get(), etk_tool_toggle_button_type_get(), and etk_toolbar_type_get().

#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

Referenced by etk_shutdown().

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

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
signals array of Etk_Signal_Description that will be used to describe type signals at this level (parent signals will be inherited), this array should be terminated with ETK_SIGNAL_DESCRIPTION_SENTINEL. May be NULL if no signals should be defined.
Returns:
Returns the new type on success, NULL on failure

References constructor, destructor, hierarchy, hierarchy_depth, name, properties_hash, property_get, property_set, signals, signals_count, and type_size.

Referenced by etk_tool_button_type_get(), etk_tool_toggle_button_type_get(), and etk_toolbar_type_get().

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

References name.

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

References constructor, Etk_Property::default_value, ETK_PROPERTY_CONSTRUCT, etk_type_property_list(), Etk_Property::flags, hierarchy, hierarchy_depth, Etk_Property::id, property_set, and signals_count.

Referenced by etk_object_new_valist().

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

References destructor, hierarchy, hierarchy_depth, Etk_Object::signal_callbacks, and signals_count.

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

References hierarchy, and hierarchy_depth.

Referenced by etk_object_check_cast().

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

References hierarchy.

Referenced by etk_type_property_find().

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

References name.

Referenced by etk_object_check_cast().

Etk_Type * etk_type_get_from_name ( const char *  name  ) 

Gets the Etk_Type from the type's name.

Parameters:
name the type's name
Returns:
Returns the Etk_Type of the type's name, or NULL on failure

Etk_Signal * etk_type_signal_get_by_name ( 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

References Etk_Signal::name, signals, and signals_count.

Etk_Signal * etk_type_signal_get ( Etk_Type *  type,
int  signal_code 
)

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

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

References signals, and signals_count.

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

References etk_property_new(), and properties_hash.

Referenced by etk_toolbar_type_get().

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)

References etk_type_parent_type_get(), and properties_hash.

Referenced by etk_object_properties_get_valist(), etk_object_properties_set_valist(), and etk_object_property_reset().

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

References properties_hash.

Referenced by etk_type_object_construct().