Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Prop container

The prop container (proportional container), is used to manage widgets that are laid out along one vertical or horizontal axis. The widgets are laid out such that their sizes are proportional to each other and are set at insertion time by the application developer.

The prop container lays out all of its widgets in a single direction, either vertically or horizontally. The widgets are laid out left to right or top to bottom in the order that the widgets appear in the container's widget stack, with the prop container dictating the extent granted to each object. The prop container determines its children's extent based on a provided proportional value -- a value that is expressed either explicitly as a ratio that is measured in relationship to all other objects within that container, or implicitly as a constant that determines the size of the object independent of other objects held within the container. Therefore, depending on the requirements of each object held in the container, the relative size of the objects within that container may vary as the size of the container changes.

For example, three widgets laid out vertically, with each widget assigned a different proportional value. The widgets are sized and positioned in the container based on the size of the container and vertical extent of each widget.

The prop container maintains each of the characteristics common to the container object, while an additional attribute describes the direction of the objects are to be laid out within the container.

The prop container is described in greater detail in the http://developer.brewmp.com/reference/api-all, under IPropContainer.

Using prop container

This example creates two widgets, sets various properties for these widgets, and inserts them into a prop container.

   IWidget *piDateWidget = NULL;
   IWidget *piTimeWidget = NULL;
   IPropContainer *picProp = NULL;
   IWidget *piwProp = NULL;
   int nErr = AEE_SUCESS;
   WidgetProp WidProp;
   WidgetExtent we;
   IBitmap *pib = NULL;

   ERR_TRY( ISHELL_CreateInstance(piShell, AEECLSID_CPropContainer, (void**) 
                   &picProp));
   ERR_TRY( IPropContainer_QueryInterface(picProp, AEEIID_IWidget, (void**)
                   &piwProp));
   ERR_TRY( ISHELL_CreateInstance(piShell, AEECLSID_CJulianDateWidget, (void**) 
                   &piDateWidget));
   ERR_TRY( ISHELL_CreateInstance(piShell, AEECLSID_CJulianTimeWidget, (void**) 
                   &piTimeWidget));
   pib = ISHELL_LoadBitmap(piShell, "images/arrows.bmp");
   if (NULL == pib) {
      ERR_THROW(EFAILED);
   }

   // Set arrow image for date/time widget
   ERR_TRY( IWidget_SetImageStrip(piDateWidget, pib));
   ERR_TRY( IWidget_SetImageStrip(piTimeWidget, pib));

   // Set arrow padding for date/time widget
   ERR_TRY( IWidget_SetArrowPad(piDateWidget, 5));
   ERR_TRY( IWidget_SetArrowPad(piTimeWidget, 5));

   we.height = 60;
   we.width = me->rcContainer.dx;

   IWidget_SetExtent(piDateWidget, &we);
   IWidget_SetExtent(piTimeWidget, &we);

   ERR_TRY(IWidget_SetTopPadding(piwProp, 20));
   ERR_TRY( IWidget_SetBGColor(piwProp, RGB_TAB_2));
   ERR_TRY( IWidget_SetFlags(piDateWidget, DTWF_USEUPDOWNKEYS | 
                                           DTWF_SHOWUPDOWNARROWS));
   ERR_TRY( IWidget_SetFlags(piTimeWidget, DTWF_USEUPDOWNKEYS | 
                                           DTWF_SHOWUPDOWNARROWS));


   WidProp.bVisible = TRUE;
   WidProp.prop = WIDGET_KEEP_EXTENT;
   ERR_TRY( IPropContainer_Insert(picProp, piDateWidget, WIDGET_ZNORMAL, 
                                                             &WidProp));
   ERR_TRY( IPropContainer_Insert(picProp, piTimeWidget, WIDGET_ZNORMAL, 
                                                             &WidProp));
   ERR_TRY( ICardContainer_Insert(picc, piwProp, WIDGET_ZBOTTOMMOST) );