Exemplo n.º 1
0
		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);
		}
Exemplo n.º 2
0
		//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;
		}
Exemplo n.º 3
0
		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);
		}
Exemplo n.º 4
0
		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;
		}
Exemplo n.º 5
0
		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;
			}
		}
Exemplo n.º 6
0
		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);
			}
		}
Exemplo n.º 7
0
		//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());
			}
		}
Exemplo n.º 8
0
		//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());
			}
		}
Exemplo n.º 9
0
		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;
		}
Exemplo n.º 10
0
		//Constructors
		public TableGroup()
		{
			Expanded = true;
			Rows = new TableItems(typeof(TableRow));
			Groups = new TableItems(typeof(TableGroup));
		}