private TableItem GetGroupTableItem(TableItems groups, PointF local, ref float currentHeight) { //Check the groups and each rows collection inside groups foreach (TableGroup tableGroup in groups) { if (local.Y >= currentHeight && local.Y <= currentHeight + GroupHeight) { return(tableGroup); } currentHeight += GroupHeight; if (tableGroup.Expanded) { TableItem item = GetGroupTableItem(tableGroup.Groups, local, ref currentHeight); if (item != null) { return(item); } foreach (TableRow tableRow in tableGroup.Rows) { if (local.Y >= currentHeight && local.Y <= currentHeight + GroupHeight) { return(tableRow); } currentHeight += RowHeight; } } } return(null); }
//Copy all rows from source to target via clone public static void CopyRows(TableItems source, TableItems target) { foreach (TableRow row in source) { target.Add((TableRow)row.Clone()); } }
//Copy all rows from source to target via clone public static void CopyGroups(TableItems source, TableItems target) { foreach (TableGroup group in source) { target.Add((TableGroup)group.Clone()); } }
public TableGroup(TableGroup prototype): base(prototype) { mExpanded = prototype.Expanded; Rows = new TableItems(typeof(TableRow)); Groups = new TableItems(typeof(TableGroup)); Table.CopyRows(prototype.Rows,Rows); Table.CopyGroups(prototype.Groups, Groups); }
public TableGroup(TableGroup prototype) : base(prototype) { mExpanded = prototype.Expanded; Rows = new TableItems(typeof(TableRow)); Groups = new TableItems(typeof(TableGroup)); Table.CopyRows(prototype.Rows, Rows); Table.CopyGroups(prototype.Groups, Groups); }
private void RenderTableRows(Graphics graphics, IRender render, TableItems rows, ref float iHeight) { foreach (TableRow tableRow in rows) { tableRow.SuspendEvents = true; tableRow.SetRectangle(new RectangleF(0, iHeight, Width, RowHeight)); tableRow.Render(graphics, render); iHeight += RowHeight; tableRow.SuspendEvents = false; } }
private TableGroup GetTableGroupExpander(TableItems groups, PointF local) { foreach (TableGroup group in groups) { RectangleF expander = new RectangleF(group.Indent + 4, group.Rectangle.Top + 4, 11, 11); if (expander.Contains(local)) { return(group); } //Sub groups TableGroup result = GetTableGroupExpander(group.Groups, local); if (result != null) { return(result); } } return(null); }
//Constructors public Table() { SuspendEvents = true; Groups = new TableItems(typeof(TableGroup)); Rows = new TableItems(typeof(TableRow)); HeadingHeight = 40; Heading = "Heading"; SubHeading = "Sub Heading"; GroupHeight = 20; RowHeight = 20; Indent = 16; ExpandedSize = Size; ContractedSize = new SizeF(Size.Width, CalculateHeight()); Expanded = true; DrawExpand = false; Forecolor = Color.Black; GradientColor = SystemColors.Control; DrawSelectedItem = true; SuspendEvents = false; }
//Constructors public Table() { SuspendEvents = true; Groups = new TableItems(typeof(TableGroup)); Rows = new TableItems(typeof(TableRow)); HeadingHeight = 40; Heading = "Heading"; SubHeading = "Sub Heading"; GroupHeight = 20; RowHeight = 20; Indent = 16; ExpandedSize = Size; ContractedSize = new SizeF(Size.Width,CalculateHeight()); Expanded = true; DrawExpand = false; Forecolor = Color.Black; GradientColor = SystemColors.Control; DrawSelectedItem = true; SuspendEvents = false; }
private void RenderTableGroups(Graphics graphics, IRender render, TableItems groups, ref float iHeight) { foreach (TableGroup tableGroup in groups) { tableGroup.SuspendEvents = true; tableGroup.SetRectangle(new RectangleF(0, iHeight, Width, GroupHeight)); tableGroup.Render(graphics, render); iHeight += GroupHeight; tableGroup.SuspendEvents = false; //Render groups and rows recursively if (tableGroup.Groups.Count > 0 && tableGroup.Expanded) { RenderTableGroups(graphics, render, tableGroup.Groups, ref iHeight); } if (tableGroup.Rows.Count > 0 && tableGroup.Expanded) { RenderTableRows(graphics, render, tableGroup.Rows, ref iHeight); } } }
public Table(Table prototype): base(prototype) { mHeadingHeight = prototype.HeadingHeight; mHeading = prototype.Heading; mSubHeading = prototype.SubHeading; mGroupHeight = prototype.GroupHeight; mRowHeight = prototype.RowHeight; mRowIndent = prototype.Indent; mExpanded = prototype.Expanded; mDrawExpand = prototype.DrawExpand; mForecolor = prototype.Forecolor; GradientColor = prototype.GradientColor; mDrawSelectedItem = prototype.DrawSelectedItem; mFont = prototype.Font; ContractedSize = prototype.ContractedSize; ExpandedSize = prototype.ExpandedSize; Groups = new TableItems(typeof(TableGroup)); Rows = new TableItems(typeof(TableRow)); Table.CopyGroups(prototype.Groups,Groups); Table.CopyRows(prototype.Rows,Rows); }
public Table(Table prototype) : base(prototype) { mHeadingHeight = prototype.HeadingHeight; mHeading = prototype.Heading; mSubHeading = prototype.SubHeading; mGroupHeight = prototype.GroupHeight; mRowHeight = prototype.RowHeight; mRowIndent = prototype.Indent; mExpanded = prototype.Expanded; mDrawExpand = prototype.DrawExpand; mForecolor = prototype.Forecolor; GradientColor = prototype.GradientColor; mDrawSelectedItem = prototype.DrawSelectedItem; mFont = prototype.Font; ContractedSize = prototype.ContractedSize; ExpandedSize = prototype.ExpandedSize; Groups = new TableItems(typeof(TableGroup)); Rows = new TableItems(typeof(TableRow)); Table.CopyGroups(prototype.Groups, Groups); Table.CopyRows(prototype.Rows, Rows); }
private void RenderTableGroups(Graphics graphics, IRender render, TableItems groups,ref float iHeight) { foreach (TableGroup tableGroup in groups) { tableGroup.SuspendEvents = true; tableGroup.SetRectangle(new RectangleF(0, iHeight, Width, GroupHeight)); tableGroup.Render(graphics,render); iHeight+=GroupHeight; tableGroup.SuspendEvents = false; //Render groups and rows recursively if (tableGroup.Groups.Count > 0 && tableGroup.Expanded) RenderTableGroups(graphics, render, tableGroup.Groups, ref iHeight); if (tableGroup.Rows.Count > 0 && tableGroup.Expanded) RenderTableRows(graphics, render, tableGroup.Rows, ref iHeight); } }
//Copy all rows from source to target via clone public static void CopyGroups(TableItems source,TableItems target) { foreach (TableGroup group in source) { target.Add((TableGroup) group.Clone()); } }
//Copy all rows from source to target via clone public static void CopyRows(TableItems source,TableItems target) { foreach (TableRow row in source) { target.Add((TableRow) row.Clone()); } }
//Constructors public TableGroup() { Expanded = true; Rows = new TableItems(typeof(TableRow)); Groups = new TableItems(typeof(TableGroup)); }
private TableItem GetGroupTableItem(TableItems groups, PointF local, ref float currentHeight) { //Check the groups and each rows collection inside groups foreach (TableGroup tableGroup in groups) { if (local.Y >= currentHeight && local.Y <= currentHeight + GroupHeight) return tableGroup; currentHeight += GroupHeight; if (tableGroup.Expanded) { TableItem item = GetGroupTableItem(tableGroup.Groups, local, ref currentHeight); if (item != null) return item; foreach (TableRow tableRow in tableGroup.Rows) { if (local.Y >= currentHeight && local.Y <= currentHeight + GroupHeight) return tableRow; currentHeight += RowHeight; } } } return null; }
private void RenderTableRows(Graphics graphics, IRender render,TableItems rows,ref float iHeight) { foreach (TableRow tableRow in rows) { tableRow.SuspendEvents = true; tableRow.SetRectangle(new RectangleF(0,iHeight,Width,RowHeight)); tableRow.Render(graphics,render); iHeight+=RowHeight; tableRow.SuspendEvents = false; } }
private TableGroup GetTableGroupExpander(TableItems groups, PointF local) { foreach (TableGroup group in groups) { RectangleF expander = new RectangleF(group.Indent + 4, group.Rectangle.Top + 4, 11, 11); if (expander.Contains(local)) return group; //Sub groups TableGroup result = GetTableGroupExpander(group.Groups, local); if (result != null) return result; } return null; }