Example #1
0
		internal bool confirmModify(ChartObject item)
		{
			PointF point = AlignPointToGrid(interaction.CurrentPoint);
			int selHandle = interaction.SelectionHandle;
			bool validated = true;

			switch (item.getType())
			{
				case ItemType.Box:
					if (BoxModifying != null)
					{
						Box box = (Box)item;
						BoxConfirmArgs args = new BoxConfirmArgs(box, point, selHandle);
						BoxModifying(this, args);
						validated = args.Confirm;
					}
					break;
				case ItemType.ControlHost:
					if (ControlHostModifying != null)
					{
						ControlHost host = (ControlHost)item;
						ControlHostConfirmArgs args = new ControlHostConfirmArgs(host, point, selHandle);
						ControlHostModifying(this, args);
						validated = args.Confirm;
					}
					break;
				case ItemType.Table:
					if (TableModifying != null)
					{
						Table table = (Table)item;
						TableConfirmArgs args = new TableConfirmArgs(table, point, selHandle);
						TableModifying(this, args);
						validated = args.Confirm;
					}
					break;
				case ItemType.Arrow:
					if (ArrowModifying != null)
					{
						Arrow arrow = (Arrow)item;
						ArrowConfirmArgs args = new ArrowConfirmArgs(arrow, point, selHandle);
						ArrowModifying(this, args);
						validated = args.Confirm;
					}
					break;
			}

			return validated;
		}
Example #2
0
		internal bool confirmSelect(ChartObject obj)
		{
			bool res = true;

			switch (obj.getType())
			{
				case ItemType.Box:
					if (BoxSelecting != null)
					{
						BoxConfirmArgs args = new BoxConfirmArgs((Box)obj);
						BoxSelecting(this, args);
						res = args.Confirm;
					}
					break;
				case ItemType.ControlHost:
					if (ControlHostSelecting != null)
					{
						ControlHostConfirmArgs args = new ControlHostConfirmArgs((ControlHost)obj);
						ControlHostSelecting(this, args);
						res = args.Confirm;
					}
					break;
				case ItemType.Table:
					if (TableSelecting != null)
					{
						TableConfirmArgs args = new TableConfirmArgs((Table)obj);
						TableSelecting(this, args);
						res = args.Confirm;
					}
					break;
				case ItemType.Arrow:
					if (ArrowSelecting != null)
					{
						ArrowConfirmArgs args = new ArrowConfirmArgs((Arrow)obj);
						ArrowSelecting(this, args);
						res = args.Confirm;
					}
					break;
			}

			return res;
		}
Example #3
0
		internal bool confirmCreate(ChartObject item)
		{
			PointF point = AlignPointToGrid(interaction.CurrentPoint);
			bool validated = true;

			switch (item.getType())
			{
				case ItemType.Box:
					if (BoxCreating != null)
					{
						BoxConfirmArgs args = new BoxConfirmArgs((Box)item, point, -1);
						BoxCreating(this, args);
						validated = args.Confirm;
					}
					break;
				case ItemType.ControlHost:
					if (ControlHostCreating != null)
					{
						ControlHostConfirmArgs args =
							new ControlHostConfirmArgs((ControlHost)item, point, -1);
						ControlHostCreating(this, args);
						validated = args.Confirm;
					}
					break;
				case ItemType.Table:
					if (TableCreating != null)
					{
						TableConfirmArgs args = new TableConfirmArgs((Table)item, point, -1);
						TableCreating(this, args);
						validated = args.Confirm;
					}
					break;
				case ItemType.Arrow:
					if (ArrowCreating != null)
					{
						Arrow arrow = (Arrow)item;

						PointF endPt = arrow.Points[arrow.Points.Count - 1];
						int id = 0;
						int row = -1;
						arrow.NewDest.getAnchor(endPt, arrow, true, ref id);
						if (arrow.NewDest is Table)
							row = ((Table)arrow.NewDest).rowFromPt(endPt);

						AttachConfirmArgs args = new AttachConfirmArgs(
							arrow, arrow.NewDest, false, id, row);
						ArrowCreating(this, args);

						validated = args.Confirm;
					}
					break;
			}

			return validated;
		}
Example #4
0
		private bool confirmTableInplaceEdit(Table tbl, int row, int col)
		{
			if (TableInplaceEditing == null) return true;

			TableConfirmArgs args = new TableConfirmArgs(tbl, row, col);
			TableInplaceEditing(this, args);
			return args.Confirm;
		}