Widget's have a parent (container) object. For instance, in the case of a button on a window, the parent of the PtButton widget is the PtWindow widget that contains it. Photon has the concept of containers and parents. ??? This needs more explanation ???
/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
/* Local headers */
#include "ablibs.h"
#include "abimport.h"
#include "proto.h"
int
SetParentBlue( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PtWidget_t *myParent;
/* eliminate 'unreferenced' warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
myParent = PtGetParent(widget, PtWindow);
PtSetResource( myParent, Pt_ARG_FILL_COLOR, Pg_BLUE, 0);
return( Pt_CONTINUE );
}
Explanation
PtWidget_t
) is returned from the function
PtGetParent
. The first parameter to this function is
the widget that generated the callback, whilst the second
paramater is the type of widget to search for in the parentage.
Note that the parent widget returned is the first widget that
matches the given type. In other words, the function returns the
relevant ancestor, since it will keep searching up the
hierarchy until it finds a matching widget (or it reaches the
oldest ancestor).myParent
) is used to
indicate which widget's resource we want to change. It is the
first parameter of the call to
PtSetResource
Home | About Me | Copyright © Neil Carter |
Content last updated: 2003-09-23