|
|
#include <Xm/XmP.h>void XmResolveAllPartOffsets (widget_class, offset, constraint_offset) WidgetClass widget_class; XmOffsetPtr * offset; XmOffsetPtr * constraint_offset;
If the widget is a subclass of the Constraint class and it defines additional constraint resources, create an offset resource list for the constraint part as well. Instead of using XtOffset for the offset, the widget uses XmConstraintPartOffset in the constraint resource list.
XmPartResource resources[] = { { BarNxyz, BarCXyz, XmRBoolean, sizeof(Boolean), XmPartOffset(Bar,xyz), XmRImmediate, (XtPointer)False } };XmPartResource constraints[] = { { BarNmaxWidth, BarNMaxWidth, XmRDimension, sizeof(Dimension), XmConstraintPartOffset(Bar,max_width), XmRImmediate, (XtPointer)100 } };
#define BarIndex (XmBulletinBIndex + 1)
XmField(w, offset, Label , text, char *) XmPartOffset(Label , text).Therefore, you must not have any spaces after the part (Label) argument, as illustrated here:
XmField(w, offset, Label, text, char *)You can define macros for each field to make this easier. Assume an integer field xyz:
#define BarXyz(w) (*(int *)(((char *) w) + \ offset[BarIndex] + XtOffset(BarPart,xyz)))For constraint field max_width:
#define BarMaxWidth(w) \ XmConstraintField(w,constraint_offsets,Bar,max_width,Dimension)
The parameters for XmResolveAllPartOffsets are defined below: