Exemple #1
0
		public ControlHost(ControlHost prototype) : base(prototype)
		{
			ctrlMouseAction = prototype.ctrlMouseAction;

			_control = null;
			if (prototype._control != null)
			{
				System.Type controlType = prototype._control.GetType();
				if (controlType != null)
				{
					// Instantiate the control
					ConstructorInfo ctorInfo =
						controlType.GetConstructor(System.Type.EmptyTypes);

					_control = (System.Windows.Forms.Control)ctorInfo.Invoke(null);
					if (_control != null)
						_control.Visible = false;
				}
			}

			setExpandable(prototype.Expandable);
			setExpanded(prototype.Expanded);

			selStyle = prototype.selStyle;
		}
Exemple #2
0
 public ControlHostConfirmArgs(ControlHost host)
 {
     this.controlHost = host;
     this.point       = new PointF(0, 0);
     this.handle      = -1;
     confirm          = true;
 }
Exemple #3
0
 public ControlHostConfirmArgs(ControlHost host, PointF point, int handle)
 {
     this.controlHost = host;
     this.point       = point;
     this.handle      = handle;
     confirm          = true;
 }
Exemple #4
0
        public ControlHost(ControlHost prototype) : base(prototype)
        {
            ctrlMouseAction = prototype.ctrlMouseAction;

            _control = null;
            if (prototype._control != null)
            {
                System.Type controlType = prototype._control.GetType();
                if (controlType != null)
                {
                    // Instantiate the control
                    ConstructorInfo ctorInfo =
                        controlType.GetConstructor(System.Type.EmptyTypes);

                    _control = (System.Windows.Forms.Control)ctorInfo.Invoke(null);
                    if (_control != null)
                    {
                        _control.Visible = false;
                    }
                }
            }

            setExpandable(prototype.Expandable);
            setExpanded(prototype.Expanded);

            selStyle = prototype.selStyle;
        }
Exemple #5
0
 public ControlPaintArgs(Graphics g, ControlHost host, RectangleF rect) :
     base(host)
 {
     this.graphics = g;
     this.rect     = rect;
     this.handled  = true;
 }
Exemple #6
0
        public ControlHostMouseArgs(ControlHost host, MouseButtons btn, float x, float y, PointF documentPos) :
            base(btn, x, y)
        {
            controlHost = host;

            this.documentPos = documentPos;
            mnpHandle        = host.getHandleIdx(documentPos);
        }
Exemple #7
0
		public ControlPaintArgs(Graphics g, ControlHost host, RectangleF rect) :
			base(host)
		{
			this.graphics = g;
			this.rect = rect;
			this.handled = true;
		}
Exemple #8
0
		public ControlHostMouseArgs(ControlHost host, float x, float y, int mnpHandle) :
			base(x, y, mnpHandle)
		{
			controlHost = host;
		}
Exemple #9
0
		public void Remove(ControlHost host)
		{
			List.Remove(host);
		}
Exemple #10
0
		public void Add(ControlHost host)
		{
			List.Add(host);
		}
Exemple #11
0
		internal void fireControlHostSerializing(ControlHost host, BinaryWriter writer)
		{
			// Consider user
			if (ControlHostSerializing != null)
			{
				MemoryStream stream = new MemoryStream(0);
				ControlHostSerializing(this,
					new ControlHostSerializeArgs(host, stream));

				// Append the stream
				byte[] b = stream.GetBuffer();
				writer.Write(b.Length);
				writer.Write(b);
			}
			else
			{
				// No user storage
				writer.Write((int)0);
			}
		}
Exemple #12
0
 public ControlHostEventArgs(ControlHost host)
 {
     controlHost = host;
 }
Exemple #13
0
		/// <summary>
		/// Creates a new ControlHost instance and adds it to the flowchart.
		/// </summary>
		/// <param name="x">Horizontal position of the ControlHost.</param>
		/// <param name="y">Vertical position of the ControlHost.</param>
		/// <param name="width">Width of the ControlHost.</param>
		/// <param name="height">Height of the ControlHost.</param>
		/// <returns>A reference to the new ControlHost.</returns>
		public ControlHost CreateControlHost(float x, float y, float width, float height)
		{
			ControlHost newHost = new ControlHost(this);
			newHost.setPos(x, y, width, height);
			newHost.updateControlPosition();

			Add(newHost, SelectAfterCreate);

			return newHost;
		}
Exemple #14
0
 public void Insert(int i, ControlHost host)
 {
     List.Insert(i, host);
 }
Exemple #15
0
 public void Add(ControlHost host)
 {
     List.Add(host);
 }
Exemple #16
0
 public ControlHostMouseArgs(ControlHost host, float x, float y, int mnpHandle) :
     base(x, y, mnpHandle)
 {
     controlHost = host;
 }
Exemple #17
0
		public ControlHostLink(ControlHost host, Arrow arrow, bool incoming) :
			base(arrow, incoming)
		{
			this.host = host;
		}
Exemple #18
0
		internal bool paintControlHost(Graphics g, ControlHost host, RectangleF rect)
		{
			if (PaintControlHost != null)
			{
				ControlPaintArgs args = new ControlPaintArgs(g, host, rect);
				PaintControlHost(this, args);
				return args.Handled;
			}

			return false;
		}
Exemple #19
0
 public void Remove(ControlHost host)
 {
     List.Remove(host);
 }
Exemple #20
0
 public ControlHostSerializeArgs(ControlHost host, Stream stream)
 {
     this.host   = host;
     this.stream = stream;
 }
Exemple #21
0
		private ItemsAndGroups copySelection(
			FlowChart doc, bool unconnectedArrows, bool copyGroups)
		{
			if (doc.Selection.Objects.Count == 0)
				return null;

			// determine which items and groups to copy
			ChartObjectCollection items = new ChartObjectCollection();
			GroupCollection groups = new GroupCollection();
			Hashtable indexMap = new Hashtable();
			for (int i = 0; i < doc.Selection.Objects.Count; ++i)
			{
				ChartObject item = doc.Selection.Objects[i];

				// do not copy unconncted arrows if specified
				if (!unconnectedArrows && item is Arrow)
				{
					Arrow arrow = item as Arrow;
					if (!arrow.IsConnected) continue;
				}

				indexMap[item] = items.Count;
				items.Add(item);
				
				if (copyGroups && item.SubordinateGroup != null)
					groups.Add(item.SubordinateGroup);
			}

			// add subordinated group items
			foreach (Group group in groups)
			{
				foreach (ChartObject item in group.AttachedObjects)
				{
					if (!items.Contains(item))
					{
						indexMap[item] = items.Count;
						items.Add(item);
					}
				}
			}

			// copy nodes
			for (int i = 0; i < items.Count; ++i)
			{
				ChartObject item = items[i];

				if (item is Box) items[i] = new Box((Box)item);
				if (item is ControlHost) items[i] = new ControlHost((ControlHost)item);
				if (item is Table) items[i] = new Table((Table)item);
			}

			// copy arrows, linking them to node clones
			for (int i = 0; i <  items.Count; ++i)
			{
				if (items[i] is Arrow)
				{
					Arrow arrow = items[i] as Arrow;

					int srcIndex = indexMap.Contains(arrow.Origin) ?
						(int)indexMap[arrow.Origin] : -1;
					int dstIndex = indexMap.Contains(arrow.Destination) ?
						(int)indexMap[arrow.Destination] : -1;

					items[i] = new Arrow(arrow,
						srcIndex == -1 ? Dummy : items[srcIndex] as Node,
						dstIndex == -1 ? Dummy : items[dstIndex] as Node);
				}
			}

			// copy groups
			for (int i = 0; i < groups.Count; ++i)
			{
				Group group = new Group(groups[i]);
				groups[i] = group;
				group.setMainObject(items[(int)indexMap[group.MainObject]]);

				foreach (Attachment atc in group.Attachments)
				{
					atc.node = items[(int)indexMap[atc.node]] as Node;
					atc.node.putInGroup(group);
				}
				group.updateObjCol();
			}

			return new ItemsAndGroups(items, groups);
		}
Exemple #22
0
		public ControlHostConfirmArgs(ControlHost host)
		{
			this.controlHost = host;
			this.point = new PointF(0, 0);
			this.handle = -1;
			confirm = true;
		}
Exemple #23
0
		internal void fireControlHostDeleted(ControlHost host)
		{
			if (ControlHostDeleted != null)
				ControlHostDeleted(this, new ControlHostEventArgs(host));
		}
Exemple #24
0
		public ControlHostConfirmArgs(ControlHost host, PointF point, int handle)
		{
			this.controlHost = host;
			this.point = point;
			this.handle = handle;
			confirm = true;
		}
Exemple #25
0
		internal void fireControlHostDeserializing(ControlHost host, BinaryReader reader)
		{
			int len = reader.ReadInt32();
			if (len > 0)
			{
				byte[] buf = reader.ReadBytes(len);
				MemoryStream stream = new MemoryStream(buf, false);
				if (ControlHostDeserializing != null)
					ControlHostDeserializing(this,
						new ControlHostSerializeArgs(host, stream));
			}
		}
Exemple #26
0
		public ControlHostSerializeArgs(ControlHost host, Stream stream)
		{
			this.host= host;
			this.stream = stream;
		}
Exemple #27
0
		public void Insert(int i, ControlHost host)
		{
			List.Insert(i, host);
		}
Exemple #28
0
		public ControlHostEventArgs(ControlHost host)
		{
			controlHost = host;
		}
Exemple #29
0
 public ControlHostLink(ControlHost host, Arrow arrow, bool incoming) :
     base(arrow, incoming)
 {
     this.host = host;
 }
Exemple #30
0
		public ControlHostMouseArgs(ControlHost host, MouseButtons btn, float x, float y, PointF documentPos) :
			base(btn, x, y)
		{
			controlHost = host;

			this.documentPos = documentPos;
			mnpHandle = host.getHandleIdx(documentPos);
		}