Go to the source code of this file.
|
TEMU_API temu_Class * | temu_registerComponent (const char *CompClass, temu_ObjectCreateFunc Create, temu_ObjectDisposeFunc Dispose) |
|
TEMU_API temu_Component_ * | temu_componentCreate (const char *Name) |
|
TEMU_API void | temu_componentDispose (void *Comp) |
|
TEMU_API void | temu_componentAddDelegateIface (temu_Component_ *Comp, const char *Name, temu_IfaceRef Iface) |
|
TEMU_API void | temu_componentAddDelegateProp (temu_Component_ *Comp, const char *Name, temu_Object_ *Obj, const char *PropName) |
|
TEMU_API temu_IfaceRef | temu_componentGetDelegateIface (temu_Component *Comp, const char *Name) |
|
TEMU_API temu_PropName | temu_componentGetDelegateProp (temu_Component *Comp, const char *Name) |
|
TEMU_API temu_Object_ * | temu_createComponentObject (temu_Component_ *Comp, const char *Class, const temu_CreateArg *Args, const char *ObjNameFmt,...) |
|
TEMU_API temu_Object_ * | temu_componentGetObject (temu_Component_ *Comp, const char *Name) |
|
TEMU_API void | temu_foreachComponent (void(*Func)(temu_Component *, void *), void *Arg) |
|
TEMU_API void | temu_foreachRootComponent (void(*Func)(temu_Component *, void *), void *Arg) |
|
◆ TEMU_COMPONENT_DEFINED
#define TEMU_COMPONENT_DEFINED |
◆ temu_Component
◆ temu_componentAddDelegateIface()
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.
- Parameters
-
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_componentAddDelegateProp()
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.
- Parameters
-
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_componentCreate()
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.
- Parameters
-
- Returns
- Component pointer
◆ temu_componentDispose()
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.
- Parameters
-
Comp | Component to dispose. |
◆ temu_componentGetDelegateIface()
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.
- Parameters
-
Comp | The component to query the IfaceRef from |
Name | Name of the interface reference. |
- Returns
- Interface reference associated with Name, if none is found, iref type will be teTY_Invalid.
◆ temu_componentGetDelegateProp()
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.
- Parameters
-
Comp | The componten to query |
Name | Name of delegated property |
- Returns
- Object name pair with the target object and property name.
◆ temu_componentGetObject()
Get named object in component
- Parameters
-
Comp | Component pointer |
Name | String without the component prefix (i.e. local name) |
- Returns
- NULL if the object is not a member in the component
◆ temu_createComponentObject()
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]-'.
- Parameters
-
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. |
- Returns
- Pointer to created object.
◆ temu_foreachComponent()
Iterate over all components and call a function on them
- Parameters
-
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_foreachRootComponent()
Iterate over all root components and call a function on them
- Parameters
-
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_registerComponent()
Register a new component class in
- Parameters
-
CompClass | Name of the component to be registered |
Create | The constructor function that allocates the component |
Dispose | The destructor function |
- Returns
- Pointer to the new class