virtual public void AddRow(Control c) { tableLayoutPanel1.AutoSize = !mbAutoScroll; int oldHeight = tableLayoutPanel1.Height; //tableLayoutPanel1.AutoSize = true; //tableLayoutPanel1.RowStyles.Insert(mControls.Count, new RowStyle(SizeType.AutoSize)); tableLayoutPanel1.RowStyles.Insert(mControls.Count, new RowStyle(SizeType.Absolute, c.Height)); tableLayoutPanel1.Controls.Add(c, 1, mControls.Count); ContainerListDragButton sb = new ContainerListDragButton(this); sb.Tag = c; sb.Dock = DockStyle.Fill; tableLayoutPanel1.Controls.Add(sb, 0, mControls.Count); //tableLayoutPanel1.AutoScroll = true; //tableLayoutPanel1.AutoScrollMargin = new Size(5, 0); //tableLayoutPanel1.AutoScrollMargin.Width = 3; int change = tableLayoutPanel1.Height - oldHeight; //todo.. notify parent of height change in a proper way if (this.Parent != null && this.Parent.Parent != null) { this.Parent.Parent.Height += change; } mControls.Add(c); if (NeedsResize != null) { NeedsResize(this, null); } }
//protected virtual OnReorder(SuperListDragButton ) //?? //on delete row... virtual public void OnDelete(ContainerListDragButton button) { int rowid = tableLayoutPanel1.GetRow(button); tableLayoutPanel1.SuspendLayout(); Control innerControl = button.Tag as Control; if (innerControl != null) { tableLayoutPanel1.Controls.Remove(innerControl); mControls.Remove(innerControl); } tableLayoutPanel1.Controls.Remove(button); tableLayoutPanel1.RowStyles.RemoveAt(rowid); MoveControlsUpN(tableLayoutPanel1, rowid, 1); tableLayoutPanel1.ResumeLayout(); if (NeedsResize != null) { NeedsResize(this, null); } }
//protected private void SuperListDragButton_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.None; if (e.Data.GetDataPresent(typeof(ContainerListDragButton))) { object data = e.Data.GetData(typeof(ContainerListDragButton)); ContainerListDragButton otherButton = data as ContainerListDragButton; if (otherButton != null) { e.Effect = mParent.ValidateDragTarget(otherButton, this, e); } //e.Effect = DragDropEffects.Move; } ////DataFormat //if (e.Data.GetDataPresent(DataFormats.Bitmap)) //{ // //e.Effect = DragDropEffects.Copy; //} //else //{ // Type o = e.Data.GetType(); // //e.Effect = DragDropEffects.None; //} //if (mbDebugColors) // this.BackColor = Color.GreenYellow; //this.BackColor = mDragOverColor; }
//private void SuperListDragButton_DragDrop(object sender, DragEventArgs e) //{ // object data = e.Data.GetData(typeof(SuperListDragButton)); // SuperListDragButton otherButton = data as SuperListDragButton; // if(otherButton != null) // { // FunctorEditor ctrlMove = otherButton.Tag as FunctorEditor; // FunctorEditor ctrlTarget = this.Tag as FunctorEditor; // if(e.Effect == DragDropEffects.Move) // { // if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost) // { // mParent.OnReOrderRequest(otherButton, this); // } // else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) // { // SuperList senderParent = otherButton.GetParentList(); // senderParent.OnTransferRequest(mParent, otherButton); // //return DragDropEffects.Move; // } // } // } //} private void SuperListDragButton_DragDrop(object sender, DragEventArgs e) { object data = e.Data.GetData(typeof(ContainerListDragButton)); ContainerListDragButton otherButton = data as ContainerListDragButton; if (otherButton != null) { mParent.HandleDrop(e, otherButton, this); } }
public virtual void OnCopyRequest(ContainerList otherlist, ContainerListDragButton toMove)//, SuperListDragButton target) { //Control c = toMove.Tag as Control; ////otherlist.re //OnDelete(toMove); //otherlist.AddRow(c); //OnReordered(); //otherlist.OnReordered(); //if (NeedsResize != null) // NeedsResize(this, null); }
public override void OnDelete(ContainerListDragButton button) { PropertyFlowList flow = button.Tag as PropertyFlowList; object toDelete = flow.SelectedObject; mObjectList.Remove(toDelete); base.OnDelete(button); //ObjectDeleted if (ObjectDeleted != null) { ObjectDeleted.Invoke(flow, toDelete); } }
public void OnTransferRequest(ContainerList otherlist, ContainerListDragButton toMove)//, SuperListDragButton target) { Control c = toMove.Tag as Control; //otherlist.re OnDelete(toMove); otherlist.AddRow(c); OnReordered(); otherlist.OnReordered(); if (NeedsResize != null) { NeedsResize(this, null); } }
public void OnReOrderRequest(ContainerListDragButton toMove, ContainerListDragButton target) { Control ctrlMove = toMove.Tag as Control; Control ctrlTarget = target.Tag as Control; ReOrder(tableLayoutPanel1, tableLayoutPanel1.GetRow(toMove), tableLayoutPanel1.GetRow(target)); //if (DoReorder(ctrlMove, ctrlTarget)) //{ //} OnReordered(); if (NeedsResize != null) { NeedsResize(this, null); } }
void SuperList_DragEnter(object sender, DragEventArgs e) { if (mControls.Count > 0) { return; } e.Effect = DragDropEffects.None; if (e.Data.GetDataPresent(typeof(ContainerListDragButton))) { object data = e.Data.GetData(typeof(ContainerListDragButton)); ContainerListDragButton otherButton = data as ContainerListDragButton; if (otherButton != null) { e.Effect = ValidateDragTarget(otherButton, this, e); } //e.Effect = DragDropEffects.Move; } }
virtual public void HandleDrop(DragEventArgs e, ContainerListDragButton otherButton, ContainerListDragButton thisButton) { //FunctorEditor ctrlMove = otherButton.Tag as FunctorEditor; //FunctorEditor ctrlTarget = thisButton.Tag as FunctorEditor; //if (e.Effect == DragDropEffects.Move) //{ // if (ctrlMove.LogicalHost == ctrlTarget.LogicalHost) // { // this.OnReOrderRequest(otherButton, thisButton); // } // else if (ctrlMove.LogicalHost.GetType() == ctrlTarget.LogicalHost.GetType()) // { // SuperList senderParent = otherButton.GetParentList(); // senderParent.OnTransferRequest(this, otherButton); // //return DragDropEffects.Move; // } //} }
override public void HandleDrop(DragEventArgs e, ContainerListDragButton otherButton, ContainerListDragButton thisButton) { PropertyFlowList ctrlMove = otherButton.Tag as PropertyFlowList; PropertyFlowList ctrlTarget = thisButton.Tag as PropertyFlowList; if (e.Effect == DragDropEffects.Move) { //if (ctrlMove.SelectedObject == ctrlTarget.SelectedObject) if (ctrlMove.Parent == ctrlTarget.Parent) { this.OnReOrderRequest(otherButton, thisButton); } else if (ctrlMove.SelectedObject.GetType() == ctrlTarget.SelectedObject.GetType()) { ContainerList senderParent = otherButton.GetParentList(); senderParent.OnTransferRequest(this, otherButton); //return DragDropEffects.Move; } } }
void SuperList_DragDrop(object sender, DragEventArgs e) { if (mControls.Count == 0) { if (e.Data.GetDataPresent(typeof(ContainerListDragButton))) { object data = e.Data.GetData(typeof(ContainerListDragButton)); ContainerListDragButton otherButton = data as ContainerListDragButton; if (otherButton != null) { ContainerList senderParent = otherButton.GetParentList(); if (e.Effect == DragDropEffects.Move) { senderParent.OnTransferRequest(this, otherButton); } else if (e.Effect == DragDropEffects.Copy) { senderParent.OnCopyRequest(this, otherButton); } } } } }