the cgv namespace
Outline of the algorithm: Input parameters:
- width and height of the whole table
- elements with minimum, optimum and default width and height and resize properties
- c: Number of columns
- r: Number of rows
Method "update":
- Method "initialize_space_tables":
- Create an array with c elements for all columns (one structure per column)
- For every column do:
- Get the maximum width of elements
- Set hints for the column:
- If one of the elements is expandable then the column is expandable
- If one of the elements is shrinkable then the column is shrinkable
Do the same for all rows
- As long as the relayouting process is not finished:
- Method "distribute_space":
- Sum the space needed for all columns
- If the space is smaller than the available space:
- Expand elements that can be expanded or filled
- If the space is bigger than the available space:
- Shrink elements that can be shrunk
- Do the same for all rows
- For all elements (children) in the table at position (i,j):
- Get width at columns[i] and height at rows[j]
- Method "calculate_child_size":
- If the child can expand in X then set its width to columns[i]
- If the child cannot expand in X then set its width to its optimal width
- ... same for Y
- Try to apply the width and height for the child
- Get the width and height of the child
- If it could not set the width or height update the childs minimum width and height
- If the overall width or height exceeds the available table dimensions:
- Expand the table
- Queue another relayout iteration with the new extents
- For all elements (children) in the table:
- Method "calculate_child_pos":
- If the child's X-alignment is middle then use the remaining cell space/2 as X offset
- If the child's X-alignment is right then use the remaining cell space as X offset
- ... same for Y
- Set size and position
- If the overall table size differs from the requested size:
- Method "repair_default_values":
- Set the new minimum and default width for the table
file use this header to include opengl, glu and glew in the right order. If you need wglew.h, include <cgv_gl/gl/wgl.h> instead.