Developer

API Reference

IPropContainer_SetPadding()

Brew Release
Brew MP 1.0.2
See Also
- IPropContainer_GetPadding()
- IPropContainer_SetPaddingExact()
- IPropContainer_SetPaddingProportional()
Description
This function is used to specify the padding that will be applied before and/or after a given widget in a PropContainer. If the PropContainer is laid out vertically, padding is applied above and/or below the specified widget. If the PropContainer is laid out horizontally, the padding is applied to the left and/or right of the given widget.
The values specified for the padding may be positive or negative. Positive values tell the PropContainer to add a proportional spacer ahead of the widget. Positive values specify the spacer's proportion in relationship to other objects. It is the numerator of the fraction of this spacer's extent to the combined extents of all other proportional objects managed by the container. Negative values are interpreted as exact pixel values for spacers. To add a spacer of a fixed size ahead or behind of a widget, pass in -x where x is the width of the desired spacer in pixels.
Note, the IPropContainer_SetPaddingExact() and IPropContainer_SetPaddingProportional() macros should normally be used to set spacing before and after a widget. You'll need to use this routine to set a proportional and an exact width spacer around a given widget, though.
Parameters
  • pif
    []:
    A pointer to an IPropContainer object.
  • pw
    []:
    Identifies the widget within the prop container's widget stack that will serve as a reference point for the widget to be retrieved. This widget may be expressed explicitly as a widget pointer, or implicitly as a constant that identifies a relative position within the widget stack, as follows. WIDGET_ZNORMAL - Use the widget at the prop container's default location as the retrieval reference point. BREW interprets this to be the widget at the top of the widget stack. WIDGET_ZTOPMOST - Use the widget at the top of the widget stack as the retrieval reference point. WIDGET_ZBOTTOMMOST - Use the widget at the bottom of the widget stack as the retrieval reference point. When 'pw' is NULL, the function will return either the top or bottom widget on the stack depending on the value of 'd'. When 'pw' is NULL and 'd' is TRUE, IPropContainer_GetWidget() will return the bottommost widget. When 'pw' is NULL and 'd' is FALSE, the function will return the topmost widget.
  • dwBefore
    []:
    Specifies the padding value to be applied ahead of the widget. If this value is positive, it indicates a proportional layout value. If this value is negative, it indicates an exact pixel value.
  • dwAfter
    []:
    Specifies the padding value to be applied behind the widget. If this value is positive, it indicates a proportional layout value. If this value is negative, it indicates an exact pixel value.

Prototype
   int IPropContainer_SetPadding(
      IPropContainer *pif, 
      IWidget *pw, 
      int32 dwBefore, 
      int32 dwAfter);
Return
   
   AEE_SUCCESS   --  The spacing around the widget was successfully set.
   AEE_EBADPARM  --  The widget pointer passed in 'pw' either does not exist, or 
                 refers to a widget that is not in the prop container's widget 
                 stack.


Side Effect
Calling IPropContainer_SetPadding() will cause the PropContainer to adjust the object layout to include the newly added spacing.
Comment
Although you should normally call IPropContainer_SetPaddingExact() and IPropContainer_SetPaddingProportional(), the following code demonstrates how to add spacers around a given widget in a PropContainer:
   
       IWidget *pWidget = NULL;
       
       pWidget = IPropContainer_GetWidget (
                  pPropContainer, 
                  WIDGET_ZTOPMOST, 
                  TRUE, 
                  FALSE)) {
       if (pWidget) {
          
         // add a proportinal spacer of 1 part ahead 
         // of this widget, and an exact-width spacer 
         // of 5 pixels behind it.
         dwResult = IPROPCONTAINER_SetPadding(
                     pPropContainer, 
                     pWidget, 
                     1, 
                     -5);

       }

  • Follow