void UpdateRowHeightsNormal(IGUIContext ctx, SizeF proposedSize) { int FillRowCount = 0; float FixedRowHeight = 0; for (int i = 0; i < Table.RowCount; i++) { WidgetTableRow row = Table.Rows [i]; switch (row.SizeMode) { case TableSizeModes.Content: float maxHeight = 0; for (int k = 0; k < row.CellCount; k++) { WidgetTableCell cell = row.Cells [k]; if (cell.RowSpan == 1 && cell.Widget != null && cell.Widget.Visible) { float w = 0; for (int m = cell.Column; m < cell.Column + cell.ColumnSpan; m++) { w += Table.Columns [m].Width + CellPadding.Width; } cell.ProposedSize = new Size((int)w, (int)row.Height); cell.UpdatePreferredSize(ctx); maxHeight = Math.Max(maxHeight, cell.PreferredSize.Height); } } row.Height = maxHeight; FixedRowHeight += maxHeight; break; case TableSizeModes.None: case TableSizeModes.Fill: FillRowCount++; break; case TableSizeModes.Fixed: FixedRowHeight += row.Height; break; } } if (FillRowCount > 0) { float fillRowHeight = (proposedSize.Height - FixedRowHeight - ((Table.RowCount - 1) * CellPadding.Height)) / FillRowCount; for (int i = 0; i < Table.RowCount; i++) { WidgetTableRow row = Table.Rows [i]; if (row.SizeMode == TableSizeModes.Fill || row.SizeMode == TableSizeModes.None) { row.Height = fillRowHeight; } } } Height = (int)(Table.Rows.Sum(row => row.Height) + ((Table.Rows.Count - 1) * CellPadding.Height)); }
// *** auf den hier würde ich auch gerne verzichten.. void UpdateColumnWidthsNormal(IGUIContext ctx, SizeF proposedSize) { int columnCount = Table.ColumnCount; int FillColCount = 0; float FixedColWidth = 0; for (int i = 0; i < columnCount; i++) { WidgetTableColumn col = Table.Columns [i]; switch (col.SizeMode) { case TableSizeModes.Content: float maxWidth = 0; for (int k = 0; k < Table.RowCount; k++) { WidgetTableRow row = Table.Rows [k]; for (int m = 0; m < row.Cells.Count; m++) { WidgetTableCell cell = row.Cells [m]; if (cell.Column == i) { if (cell.ColumnSpan == 1) { cell.UpdatePreferredSize(ctx); maxWidth = Math.Max(maxWidth, cell.PreferredSize.Width); } break; } } } col.Width = maxWidth; FixedColWidth += maxWidth; break; case TableSizeModes.None: case TableSizeModes.Fill: FillColCount++; break; case TableSizeModes.Fixed: FixedColWidth += col.Width; break; } } if (FillColCount > 0) { float fillColWidth = (int)(((proposedSize.Width - FixedColWidth - ((columnCount - 1) * CellPadding.Width)) / FillColCount)); for (int i = 0; i < columnCount; i++) { WidgetTableColumn col = Table.Columns [i]; if (col.SizeMode == TableSizeModes.Fill || col.SizeMode == TableSizeModes.None) { col.Width = fillColWidth; } } } Width = (int)(Table.Columns.Sum(col => col.Width) + ((Table.Columns.Count - 1) * CellPadding.Width) + 0.5f); //DumpColumns (); }