/* public void setSubnet(string ip, string sub) * desc add the buttons and set there numbers * * param: the ip button and subnnet mask */ public void setSubnet(string ip, string sub) { System.Windows.Forms.ToolTip MyToolTip = new System.Windows.Forms.ToolTip(); string new_ip = IP_SubNetButton.splitSubNetLeft(ip, sub); int new_subnetMask = int.Parse(sub) + 1; Subnet.SubNet subnet = new Subnet.SubNet(new_ip, new_subnetMask); left = new BinaryTreeeNode(new IP_SubNetButton(subnet, mainVars), 'L', mainVars); left.getButton().Text = new_ip + "/" + new_subnetMask; left.getButton().AutoSize = true; MyToolTip.SetToolTip(left.getButton(), subnet.toString()); left.getButton().Click += (sender, args) => { mainVars.lastClicked = left; ip_SubNetButton.ButtonControls(sender); }; new_ip = IP_SubNetButton.splitSubNetRight(ip, sub); subnet = new Subnet.SubNet(new_ip, new_subnetMask); right = new BinaryTreeeNode(new IP_SubNetButton(subnet, mainVars), 'R', mainVars); right.getButton().Text = new_ip + "/" + new_subnetMask; right.getButton().AutoSize = true; MyToolTip.SetToolTip(right.getButton(), subnet.toString()); right.getButton().Click += (sender, args) => { mainVars.lastClicked = right; ip_SubNetButton.ButtonControls(sender); }; }
public void shiftRight(IP_SubNetButton root) { /*root.BottomRowLeftMostAtHead(root); * LinkedList temp = root.GetList(); * IP_SubNetButton mostLeft = root.GetList().GetHead().get_ip_subnetbutton(); * int shiftNum = root.GetButton().Location.X + root.GetButton().Width + 5 - mostLeft.GetButton().Location.X; * Node tempNode = root.GetList().GetHead(); * LinkedList parents = null; * while (tempNode != null) * { * tempNode.getButton().Location = new System.Drawing.Point( * tempNode.getButton().Location.X + shiftNum, tempNode.getButton().Location.Y * ); * if (parents == null) parents = new LinkedList(new Node(tempNode.getParent())); * else parents.Add(new Node(tempNode.getParent())); * tempNode = tempNode.next; * } * } * private void SetButtonLocation(IP_SubNetButton originalButton) * { * * Forms.Button root1 = originalButton.GetButton(), * left = originalButton.GetLeft().GetButton(), * right = originalButton.GetRight().GetButton(); * * left.Location = new System.Drawing.Point(root1.Location.X - (root1.Width), root1.Height + root1.Height / 2 + root1.Location.Y); * right.Location = new System.Drawing.Point(root1.Location.X + (root1.Width), left.Location.Y); * f.Controls.Add(left); * f.Controls.Add(right); * if (left.Location.X <= root.GetButton().Location.X +root.GetButton().Width ) * { * f.Refresh(); * shiftRight(originalButton); * }*/ }
public void shiftButtons(IP_SubNetButton ip) { /*if (ip.GetButton().Location.X > root.GetButton().Location.X) * { * shiftRight(root.GetRight(), root.GetRight().GetButton().Location.X); * } * else if (ip.GetButton().Location.X < root.GetButton().Location.X) * { * shiftLeft(root.GetLeft(), root.GetLeft().GetButton().Location.X); * }*/ }
public void shiftRight(IP_SubNetButton ip, int numShift) { if (ip == null) { return; } int x = ip.GetButton().Location.X, y = ip.GetButton().Location.Y; ip.GetButton().Location = new System.Drawing.Point(x + numShift, y); numShift /= 2; // shiftLeft(ip.GetLeft(), numShift); // shiftLeft(ip.GetRight(), numShift); }
public void setIP(IP_SubNetButton ip) { ip_SubNetButton = ip; }
public BinaryTreeeNode(IP_SubNetButton ip) { ip_SubNetButton = ip; }
public BinaryTreeeNode(IP_SubNetButton ip, char c, MainWindow mw) { mainVars = mw; ip_SubNetButton = ip; LeftOrRight = c; }