Determine the size of the window frame borders
void PtFrameSize( ulong_t render, int border_size, int *left_border, int *top_border, int *right_border, int *bottom_border );
This function returns the size of the frame borders, based on the rendering flags you pass in the render argument. You should pass the same flags that were used to define the window.
For most windows, you can set border_size to 0. But if your window sets a border width (Pt_ARG_BORDER_WIDTH), you should pass that value instead.
The function sets the remaining arguments to the frame's left, top, right, and bottom borders. These values are in pixels.
int my_setup( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) { int xoff, yoff, woff, hoff; short x, y; PtArg_t args[3]; PhArea_t *area, tarea; PhRect_t rect; /* Note: This is a PhAB prerealize setup function * for a dialog module */ /* ensure dialog is totally visible */ PtSetArg( &args[0], Pt_ARG_AREA, &area, 0 ); PtGetResources( widget, 1, &args ); tarea = *area; PtFrameSize( Ph_WM_APP_DEF_RENDER, 0, &xoff, &yoff, &woff, &hoff ); PhWindowQueryVisible( 0, 0, 0, &rect ); if ( ( tarea.x + tarea.w + xoff + woff ) > rect.xLR ) tarea.x = rect.xLR - tarea.w - xoff - woff; if ( ( tarea.y + tarea.h + yoff + hoff ) > rect.yLR ) tarea.y = rect.yLR - tarea.h - yoff - hoff; if ( tarea.x < rect.xUL ) tarea.x = rect.xUL; if ( tarea.y < rect.yUL ) tarea.y = rect.yUL; if ( area->x != tarea.x || area->y != tarea.y ) { PtSetArg( &args[0], Pt_ARG_AREA, &tarea, 0 ); PtSetResources( widget, 1, &args ); } return( Pt_CONTINUE ); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |