Blame doc/man/man3/XmResolvePartOffsets.3

Packit b099d7
'\" t
Packit b099d7
...\" ResolveP.sgm /main/9 1996/09/25 10:05:19 cdedoc $
Packit b099d7
.de P!
Packit b099d7
.fl
Packit b099d7
\!!1 setgray
Packit b099d7
.fl
Packit b099d7
\\&.\"
Packit b099d7
.fl
Packit b099d7
\!!0 setgray
Packit b099d7
.fl			\" force out current output buffer
Packit b099d7
\!!save /psv exch def currentpoint translate 0 0 moveto
Packit b099d7
\!!/showpage{}def
Packit b099d7
.fl			\" prolog
Packit b099d7
.sy sed -e 's/^/!/' \\$1\" bring in postscript file
Packit b099d7
\!!psv restore
Packit b099d7
.
Packit b099d7
.de pF
Packit b099d7
.ie     ?\\*(f1?? .ds f1 \\n(.f
Packit b099d7
.el .ie ?\\*(f2?? .ds f2 \\n(.f
Packit b099d7
.el .ie ?\\*(f3?? .ds f3 \\n(.f
Packit b099d7
.el .ie ?\\*(f4?? .ds f4 \\n(.f
Packit b099d7
.el .tm ? font overflow
Packit b099d7
.ft \\$1
Packit b099d7
..
Packit b099d7
.de fP
Packit b099d7
.ie     !?\\*(f4?? \{\
Packit b099d7
.	ft \\*(f4
Packit b099d7
.	ds f4\"
Packit b099d7
'	br \}
Packit b099d7
.el .ie !?\\*(f3?? \{\
Packit b099d7
.	ft \\*(f3
Packit b099d7
.	ds f3\"
Packit b099d7
'	br \}
Packit b099d7
.el .ie !?\\*(f2?? \{\
Packit b099d7
.	ft \\*(f2
Packit b099d7
.	ds f2\"
Packit b099d7
'	br \}
Packit b099d7
.el .ie !?\\*(f1?? \{\
Packit b099d7
.	ft \\*(f1
Packit b099d7
.	ds f1\"
Packit b099d7
'	br \}
Packit b099d7
.el .tm ? font underflow
Packit b099d7
..
Packit b099d7
.ds f1\"
Packit b099d7
.ds f2\"
Packit b099d7
.ds f3\"
Packit b099d7
.ds f4\"
Packit b099d7
.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n 
Packit b099d7
.TH "XmResolvePartOffsets" "library call"
Packit b099d7
.SH "NAME"
Packit b099d7
\fBXmResolvePartOffsets\fP \(em A function that allows writing of upward-compatible applications and widgets
Packit b099d7
.iX "XmResolvePartOffsets"
Packit b099d7
.SH "SYNOPSIS"
Packit b099d7
.PP
Packit b099d7
.nf
Packit b099d7
#include <Xm/Xm\&.h>
Packit b099d7
\fBvoid \fBXmResolvePartOffsets\fP\fR(
Packit b099d7
\fBWidgetClass \fBwidget_class\fR\fR,
Packit b099d7
\fBXmOffsetPtr \fB* offset\fR\fR);
Packit b099d7
.fi
Packit b099d7
.SH "DESCRIPTION"
Packit b099d7
.PP
Packit b099d7
The use of offset records requires one extra global variable per widget
Packit b099d7
class\&.
Packit b099d7
The variable consists of a pointer to an array of offsets into the
Packit b099d7
widget record for each part of the widget structure\&.
Packit b099d7
The \fBXmResolvePartOffsets\fP function
Packit b099d7
allocates the offset records needed by an application to guarantee
Packit b099d7
upward-compatible access to widget instance records by
Packit b099d7
applications and widgets\&.
Packit b099d7
These offset records are used by the widget to access all of the
Packit b099d7
widget\&'s variables\&.
Packit b099d7
A widget needs to take the steps described in the following paragraphs\&.
Packit b099d7
.PP
Packit b099d7
Instead of creating a resource list, the widget creates an offset
Packit b099d7
resource list\&.
Packit b099d7
To accomplish this, use the \fBXmPartResource\fR
Packit b099d7
structure and the \fBXmPartOffset\fP macro\&.
Packit b099d7
The \fBXmPartResource\fR data structure looks just like a
Packit b099d7
resource list, but instead of having
Packit b099d7
one integer for its offset, it has two shorts\&.
Packit b099d7
This structure is put into the class record as if it were a normal resource
Packit b099d7
list\&. Instead of using \fBXtOffset\fP for the offset, the widget uses
Packit b099d7
\fBXmPartOffset\fP\&.
Packit b099d7
.PP
Packit b099d7
.nf
Packit b099d7
\f(CWXmPartResource resources[] = {
Packit b099d7
  { BarNxyz, BarCXyz, XmRBoolean,
Packit b099d7
    sizeof(Boolean), XmPartOffset(Bar,xyz),
Packit b099d7
    XmRImmediate, (XtPointer)False }
Packit b099d7
};\fR
Packit b099d7
.fi
Packit b099d7
.PP
Packit b099d7
.PP
Packit b099d7
Instead of putting the widget size in the class record, the widget puts the
Packit b099d7
widget part size in the same field\&.
Packit b099d7
.PP
Packit b099d7
Instead of putting \fBXtVersion\fP in the class record, the widget puts
Packit b099d7
\fBXtVersionDontCheck\fP in the class record\&.
Packit b099d7
.PP
Packit b099d7
The widget defines a variable, of type \fBXmOffsetPtr\fR, to point to
Packit b099d7
the offset record\&.
Packit b099d7
This can be part of the widget\&'s class record or a separate global
Packit b099d7
variable\&.
Packit b099d7
.PP
Packit b099d7
In class initialization, the widget calls \fBXmResolvePartOffsets\fP,
Packit b099d7
passing it a pointer to contain the address of the offset
Packit b099d7
record and the class record\&.
Packit b099d7
This does several things:
Packit b099d7
.IP "   \(bu" 6
Packit b099d7
Adds the superclass (which, by definition, has already been initialized)
Packit b099d7
size field to the part size field
Packit b099d7
.IP "   \(bu" 6
Packit b099d7
Allocates an array based upon the number of superclasses
Packit b099d7
.IP "   \(bu" 6
Packit b099d7
Fills in the offsets of all the widget parts with the appropriate
Packit b099d7
values, determined by examining the size fields of all superclass
Packit b099d7
records
Packit b099d7
.IP "   \(bu" 6
Packit b099d7
Uses the part offset array to modify the offset entries in the resource
Packit b099d7
list to be real offsets, in place
Packit b099d7
.PP
Packit b099d7
The widget defines a constant that will be the index to its part
Packit b099d7
structure in the offsets array\&.
Packit b099d7
The value should be 1 greater than
Packit b099d7
the index of the widget\&'s superclass\&.
Packit b099d7
Constants defined for all \fBXm\fP
Packit b099d7
widgets can be found in \fBXmP\&.h\fP\&.
Packit b099d7
.PP
Packit b099d7
.nf
Packit b099d7
\f(CW#define BarIndex (XmBulletinBIndex + 1)\fR
Packit b099d7
.fi
Packit b099d7
.PP
Packit b099d7
.PP
Packit b099d7
Instead of accessing fields directly, the widget must always go through
Packit b099d7
the offset table\&.
Packit b099d7
The \fBXmField\fP macro helps you access these fields\&.
Packit b099d7
Because the \fBXmPartOffset\fP and \fBXmField\fP
Packit b099d7
macros concatenate things together, you must
Packit b099d7
ensure that there is no space
Packit b099d7
after the part argument\&.
Packit b099d7
For example, the following macros do not work because of the space
Packit b099d7
after the part (Label) argument:
Packit b099d7
.PP
Packit b099d7
.nf
Packit b099d7
\f(CWXmField(w, offset, Label, text, char *)
Packit b099d7
XmPartOffset(Label, text)\fR
Packit b099d7
.fi
Packit b099d7
.PP
Packit b099d7
.PP
Packit b099d7
Therefore, you must not have any spaces after the part (Label)
Packit b099d7
argument, as illustrated here:
Packit b099d7
.PP
Packit b099d7
.nf
Packit b099d7
\f(CWXmField(w, offset, Label, text, char *)\fR
Packit b099d7
.fi
Packit b099d7
.PP
Packit b099d7
.PP
Packit b099d7
You can define macros for each field to make this easier\&.
Packit b099d7
Assume an integer field \fIxyz\fP:
Packit b099d7
.PP
Packit b099d7
.nf
Packit b099d7
\f(CW#define BarXyz(w) (*(int *)(((char *) w) + \e
Packit b099d7
        offset[BarIndex] + XtOffset(BarPart,xyz)))\fR
Packit b099d7
.fi
Packit b099d7
.PP
Packit b099d7
.PP
Packit b099d7
The parameters for \fBXmResolvePartOffsets\fP are
Packit b099d7
.IP "\fIwidget_class\fP" 10
Packit b099d7
Specifies the widget class pointer for the created widget
Packit b099d7
.IP "\fIoffset\fP" 10
Packit b099d7
Returns the offset record
Packit b099d7
.SH "RELATED INFORMATION"
Packit b099d7
.PP
Packit b099d7
\fBXmResolveAllPartOffsets\fP(3)\&.
Packit b099d7
...\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:29