TEMU
2
The Terma Emulator
|
Go to the source code of this file.
Macros | |
#define | TEMU_COMPONENT_DEFINED |
Typedefs | |
typedef struct temu_Component | temu_Component |
#define TEMU_COMPONENT_DEFINED |
Definition at line 26 of file Component.h.
typedef struct temu_Component temu_Component |
Definition at line 27 of file Component.h.
TEMU_API void temu_componentAddDelegateIface | ( | temu_Component * | Comp, |
const char * | Name, | ||
temu_IfaceRef | Iface | ||
) |
Add delegate interface to component
Delegate interfaces are interfaces in objects internal in the component. It is possible to use the connect function to attach directly to a component delegated interface (although, in practice the connection is done to the internal object's interface).
Note that delegate interface do not support interface arrays, and can only expose a single interface instance at present.
Comp | the component to add the delegate interface to. |
Name | name of the delegate interface |
Iface | Interface reference which the delegated interface is resolved to |
TEMU_API void temu_componentAddDelegateProp | ( | temu_Component * | Comp, |
const char * | Name, | ||
void * | Obj, | ||
const char * | PropName | ||
) |
Add delegate property to component
Delegate property are properties in objects internal in the component. It is possible to use the connect function to connect from a delegated property directly using the component instead of the underlying object.
Comp | the component to add the delegate interface to. |
Name | name of the delegate property |
Obj | Object to which the property resolves to. |
PropName | Name of property in Obj |
TEMU_API temu_Component* temu_componentCreate | ( | const char * | Name | ) |
Allocate a component object.
The component create shall be called in the component constructor/create function (the create function passed to the registerComponent function). It will allocate an opaque component object with the relevant name.
The returned component is what the component constructor should return.
Name | Name of component |
TEMU_API void temu_componentDispose | ( | void * | Comp | ) |
Deallocate a component object
The component dispose shall be called by the component destructor/dispose function registered in the registerComponent call.
Note that a component is seen as owning all the objects created with createComponentObject, and subsequently, all objects created will be recursively deleted when deleting the component.
Comp | Component to dispose. |
TEMU_API temu_IfaceRef temu_componentGetDelegateIface | ( | temu_Component * | Comp, |
const char * | Name | ||
) |
Query the component for a delegated interface
Normally this function is not needed for the end user, however some usecases can be seen for exposing this. It returns the IfaceRef that has been added as a delegate interface. The main use is to redelegate delegated interfaces in a component of components.
Comp | The component to query the IfaceRef from |
Name | Name of the interface reference. |
TEMU_API temu_PropName temu_componentGetDelegateProp | ( | temu_Component * | Comp, |
const char * | Name | ||
) |
Query the compontent for a delegated property
Normally this should not be called by the user. But is useful in case the user constructs components of components in which case a component can redelegate delegated properties.
Comp | The componten to query |
Name | Name of delegated property |
TEMU_API void* temu_componentGetObject | ( | void * | Comp, |
const char * | Name | ||
) |
Get named object in component
Comp | Component pointer |
Name | String without the component prefix (i.e. local name) |
TEMU_API void* temu_createComponentObject | ( | void * | Comp, |
const char * | Class, | ||
const temu_CreateArg * | Args, | ||
const char * | ObjNameFmt, | ||
... | |||
) |
Create an object in a component.
This function works as the temu_createObject, except that the object created is inserted in the component.
The function is indended to be used in the component constructor.
Object names are uniqued using the objnamefmt paramters and following varargs. Plus, that the name of the component itself is prefixed as '[compname]-'.
Comp | The component under which the object is to be created. |
Class | class of the created object |
Args | NULL terminated array of create arguments for the constructor. |
ObjNameFmt | Name of created object, but it allows for printf style string names, simplifying the creation of multiple objects of the same type. |
TEMU_API void temu_foreachComponent | ( | void(*)(temu_Component *, void *) | Func, |
void * | Arg | ||
) |
Iterate over all components and call a function on them
Func | The function to be called on each component, with the signature Func)(temu_Component,void*) |
Arg | The second argument to be passed to the function, for passing context |
TEMU_API void temu_foreachRootComponent | ( | void(*)(temu_Component *, void *) | Func, |
void * | Arg | ||
) |
Iterate over all root components and call a function on them
Func | The function to be called on each component, with the signature Func)(temu_Component,void*) |
Arg | The second argument to be passed to the function, for passing context |
TEMU_API temu_Class* temu_registerComponent | ( | const char * | CompClass, |
temu_ObjectCreateFunc | Create, | ||
temu_ObjectDisposeFunc | Dispose | ||
) |
Register a new component class in
CompClass | Name of the component to be registered |
Create | The constructor function that allocates the component |
Dispose | The destructor function |