Name
class_part_initialize — Core method to initialize class part structure fields.
Synopsis
typedef void (∗XtWidgetClassProc)(WidgetClass);
WidgetClass class;
Arguments
classSpecifies the pointer to the widget class structure.
Description
The class_part_initialize method initializes fields in a class part structure. During class initialization, the class_part_initialize method for the class and for all its superclasses is called in superclass-to-subclass order on the class record. These procedures do any dynamic initializations necessary to their class’s part of the record, including resolution of any inherited methods defined in the class. For example, if a widget class C has superclasses Core, Composite, A, and B, then the class record for C is passed first to Core’s class_part_initialize record. This resolves any inherited Core methods and compiles the textual representations of the resource list and action table that are defined in the Core class part. Next, the Composite’s class_part_initialize is called to initialize the Composite part of C’s class record. Finally, the class_part_initialize procedures for A, B, and C (in order) are called. Classes that do not define any new class fields or that need no extra processing for them can specify the class_part_initialize field to be NULL.
All widget classes, whether they have a class initialization procedure or not, must start with their class_inited field False.
The first time a widget of a class is created, XtCreateWidget ensures that the widget class and all superclasses are initialized, in superclass-to-subclass order, by checking each class_inited field. If this field is False, XtCreateWidget calls the class_initialize and the class_part_initialize methods for the class and all its superclasses. The Intrinsics then set the class_inited field to a non-zero value. After the one-time initialization, a class structure is constant.
The following provides the class_part_initialize method for Form.
static void ClassPartInitialize(class)
WidgetClass class;
{
register FormWidgetClass c = (FormWidgetClass)class;
if (c->form_class.layout == XtInheritLayout)
c->form_class.layout = Layout;
}