If the component can take children, the following three functions might be required:
The following sections describe these functions in detail.
To identify the parent of a given widget, use the ChildParentFunction:
This function retrieves the ID of the widget to use as the XtParent of any child widgets or components added to this component. If this routine is not provided, Builder Xcessory uses the base widget of the component.
If the component needs to do any internal record keeping after a new child has been added, you can specify a ChildFunction to be called:
This routine is used to notify the component that a child has been added or is about to be removed, allowing the component to initialize or clean up any internal data relating to the child. An example of this is a component like a VkTabbedDeck, which may have an add method to register a widget or component as a tab panel after the child has been created:
extern "C" void
ModifyMyComponentChildList(void* object, Widget child,
MyComponent* obj = (MyComponent*)object;
If the component has attributes that can be set for each child, you can provide a ConstraintFunction:
This routine provides for the case of a component applying constraint style attributes to its children, like the TabbedDeck attribute tabLabel. The WML definition for these resources occurs in the section for the component, but the resource definition is declared as Constraint rather than Argument.
A resource declared in this way appears in the Constraint Resources section of any children added to MyComponent. When those resources on the children are changed, it is this method, EditComponentConstraint(), that gets called to set the value. This function is nearly identical to the component Edit function, except that both the component pointer and the child widget are passed as parameters.