Developer

API Reference

Cell types

Brew Release
Brew MP 1.0.2
Description
Each cell knows how it should be laid out. Cell type flags will determine the behavior of the cell's layout in either the x or y direction. For example, we can specify a flag to indicate that the cell should have a fixed size in the y-axis of 5 pixels. That cell will never draw taller than 5 pixels high. Since properties are set on a row and column basis, every cell in a particular row or column will have the same cell type. Consider the following example, which shows the cell type for both x and y direction. The cells are labeled with numbers for reference below.
                           CELL_KEEP_EXTENT            CELL_PROPORTIONAL
                     +--------------------------+--------------------------+
   CELL_FIXED        | [1] X: CELL_KEEP_EXTENT  | [2] X: CELL_PROPORTIONAL |
                     |     Y: CELL_FIXED        |     Y: CELL_FIXED        | 
                     +--------------------------+--------------------------+
   CELL_PROPORTIONAL | [3] X: CELL_KEEP_EXTENT  | [4] X: CELL_PROPORTIONAL |
                     |     Y: CELL_PROPORTIONAL |     Y: CELL_PROPORTIONAL | 
                     +--------------------------+--------------------------+

  Cell [1] - will use its x extent to determine the width of the cell.  The
             height of the cell will be a fixed value (determined by the 
             iValue parameter of that row's GridDescriptor)
  Cell [2] - will use a proportional width (again the value will be determined
             by the iValue member of that row's GridDescriptor).  The height
             will be a fixed value, the same as widget 1's height.  
  Cell [3] - will use the extent of the widget to determine its width, like
             cell 1.  The greater of widget 1 and 3's x-extent will be used.
             The height of widget 3 is proportional and the proportion is
             determined again by the iValue of column's GridDescriptor.
  Cell [4] - will use the proportional value the same as cell 2 for its
             x size.  The height will be the same as cell 3, since they
             share the same GridDescriptor.

Grid container is after all a grid. The example above shows that the GridDescriptor for a row or column applies to the whole row/column. Otherwise, it would not be a grid! Below is a detailed description of each cell type:
Definition                 Description
--------------             ------------------------------------------------------- 
CELL_FIXED:                The cells in this row or column will have a fixed
                           width or height, respectively.  The fixed value is
                           determined by the iValue member of the GridDescriptor
                           which describes the row or column.  The value is the
                           exact number of pixels.

CELL_KEEP_EXTENT:          The cells in this row or column will use the largest
                           widget's width or height, respectively, to determine
                           the size of the cells in the row or column.  This iValue
                           member of GridDescriptor is ignored when this flag is
                           set.

CELL_SIZE_TO_FIT:          This indicates the cell should use the widget's
                           preferred extent to size the cell.  

CELL_PROPORTIONAL:         This indicates the cells should use a proportional width
                           or height.  Proportional behavior works very much like
                           Prop Container's proportions.  The iValue member of 
                           GridDescriptor must be set to the proportional value for a
                           row/column.  Proportions only make sense in the context
                           of the remaining free space left in the row or column.  Cells
                           with CELL_KEEP_EXTENT or CELL_FIXED will not deviate in their
                           widths and heights.  The proportional value indicates what 
                           proportion of the remaining free space in the container should
                           the row/column occupy.  In the example above, if cell #3's 
                           iValue was 1 and cell #4's value was 2, then we expect cell #4
                           to be twice as wide as cell #3.  We calculate this value by
                           summing the proportions of each cell (its iValue) to determine
                           the denominator.  In this case, the denominator would be 3.  We then
                           divide the proportion of the cell by the denominator to determine
                           how much of the grid container's extent it will consume.  
                           Cell #3's x extent will be 1/3 the width of grid container while
                           Cell #4's x extent will be 2/3's the width of grid container's
                           x extent.  For a more detailed explanation of proportions, please
                           refer to prop container.
Comment
None
  • Follow