[Previous] [Contents] [Index] [Next]


Invoke the Extent method of the specified superclass


void PtSuperClassExtent( PtWidgetClassRef_t *wc_ref,
                         PtWidget_t *widget );


This function invokes the Extent method of the specified superclass wc_ref.

The PtLabel class's Extent method handles multiline text (with underlining and margins) and the resize policy.

The PtContainer class's Extent method handles the resize policy and anchoring for subclasses of PtContainer.

The PtGraphic class's Extent method calculates an extent based on an array of points, line weight, origin, and resize policy.


To have a widget honor a minimum x dimension resource:

static void my_container_extent( PtWidget_t *widget )
  MyWidget_t *mw = (MyWidget_t *)widget;
  PhRect_t canvas, render, old_extent;

  old_extent = widget->extent;

  if( PtResizePolicy( widget ) )
     PtChildBoundingBox( widget, &canvas, &render );
     if( render.lr.x - render.ul.x + 1 < mw->min_x )
       render.lr.x = render.ul.x + mw->min_x -1;
     PtAttemptResize( widget, &canvas, &render );
  }else if( widget->area.size.x < mw->min_x )
     widget->area.size.x = mw->min_x;

  PtSuperClassExtent( PtBasic, widget );

  // Apply anchoring.
  PtApplyAnchors( widget );

  if( memcmp( &widget->area, &old_area, sizeof( old_area ) ) )
     PtInvokeResizeCallbacks( widget );



Interrupt handler No
Signal handler No
Thread No

[Previous] [Contents] [Index] [Next]