next up previous contents index
Next: 2. The BaseClass Extension Up: 2. The Method Hooks Previous: 2. The Method Hooks   Contents   Index

1. The Wrapper Data Stacks

XmWrapperDataRecThe wrapper data stack plays an important role for the hook mechanism. For example, the prehook wrapper for initialize() etc. must keep the old pointer to the leaf method of the method-chain when it hooks in the posthook method instead. The old pointer is stored in a XmWrapperDataRec structure (figure [*]). These wrapper data records are linked so that they form a stack for every single widget class. The head of the stack is accessible through a base class extension record. For the moment, I'll skip the base class extension record and come back to it in the next section.

Figure: The wrapper data stack keeps saved method pointers for a widget class.
\begin{figure}
\centerline {\epsfig{file=WrapperStack.eps,scale=1.09}}\end{figure}

The layout of a XmWrapperDataRec structure is as follows:


typedef struct _XmWrapperDataRec 
{
    struct _XmWrapperDataRec *next;
    WidgetClass              widgetClass;
    XtInitProc               initializeLeaf;
    XtSetValuesFunc          setValuesLeaf;
    XtArgsProc               getValuesLeaf;
    XtRealizeProc            realize;
    XtWidgetClassProc        classPartInitLeaf;
    XtWidgetProc             resize;
    XtGeometryHandler        geometry_manager;
} XmWrapperDataRec, *XmWrapperData;

Now for a description of such a wrapper data record:


\begin{itemdescription}
\ITEM[struct \_XmWrapperDataRec *next;]
Links to the nex...
...most recent entry from the appropriate wrapper data stack.
\end{itemdescription}

Please note that the functions which work on wrapper data do not appear in any official header file (and thus not even in BaseClassP.h) and aren't accessible from the outside. This is true at least for M*TIF but unfortunately LESSTIF doesn't declare the wrapper functions static, so they are accessible. Despite this their use is strongly discouraged. I only talk about them here so you can understand their task within the BaseClass stuff. In M*TIF 2.0 the wrapper functions have lost their _Xm prefix to reflect their private state.


\begin{itemdescription}
\codeindex{\_XmPushWrapperData}%\ITEM[XmWrapperData \_...
...d by the
wrapper data structure pointed to by \code{data}.
\end{itemdescription}


next up previous contents index
Next: 2. The BaseClass Extension Up: 2. The Method Hooks Previous: 2. The Method Hooks   Contents   Index
Danny Backx
2000-12-13