Find the nth widget in an area
PtWidget_t *PtContainerHit( PtWidget_t *container, unsigned n, PhRect_t const *rect );
This function returns a pointer to the nth widget within the specified container that intersects with the provided rectangle. The coordinates of the rectangle are relative to the given container's canvas. If no widget intersects with rect, or if there are fewer than n intersections, the function returns NULL.
PtWidget_t *target_widget, *my_pane; // In my_pane's RAW callback: my_raw_cb( PtWidget_t *container, void *data, PtCallbackInfo_t *cbinfo ) { PhRect_t *rect; PtWidget_t *container; PtWidget_t *target_widget; // ... rect = PhGetRects( cbinfo->event ); container = PtFindContainer( widget ); target_widget = PtContainerHit( container, 1, rect ); if (target_widget) PtDestroyWidget( target_widget ); // ... }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PhGetRects(), PtContainerBox()