PtWidgetOffset()

Find the offset of a widget's origin

Synopsis:

PhPoint_t *PtWidgetOffset( PtWidget_t *widget,
                           PhPoint_t *offset );

Library:

ph

Description:

This function determines the offset of widget's origin from its disjoint parent widget and stores it in the PhPoint_t structure pointed to by offset.

Returns:

A pointer to a PhPoint_t structure that's the offset of the widget's origin from its parent window (the widget's position is relative to this point), or NULL if an error occurs.

Examples:

PtArg_t arg;
PhPoint_t *widget_pos;

PtSetArg( &arg, Pt_ARG_POS, &widget_pos, 0);
PtGetResources( labelwidget, 1, &arg );

if(PtWidgetOffset( labelwidget, &point))
{
    widget_position_relative_to_window.x = 
          point.x + widget_pos->x;
    widget_position_relative_to_window.y = 
          point.y + widget_pos->y;
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhPoint_t, PhTranslateRect(), PtGetAbsPosition()