private TreeListNode FindNextRaw8Bytes(TreeListNodeCollection pNodes, ref TreeListNode pAfterNode, byte[] pValue) { bool foundStart = pAfterNode == null; foreach (TreeListNode node in pNodes) { if (foundStart && node.Tag != null) { if (node.Tag is FieldNodeTag) { RiftPacketField field = (node.Tag as FieldNodeTag).Field; if (field.Type == ERiftPacketFieldType.Raw8Bytes && CompareByteArrays(pValue, field.Value.Bytes)) return node; } else if (node.Tag is RiftPacketFieldValue) { RiftPacketFieldValue value = node.Tag as RiftPacketFieldValue; if (value.Type == ERiftPacketFieldType.Raw8Bytes && CompareByteArrays(pValue, value.Bytes)) return node; } } if (!foundStart && node == pAfterNode) { foundStart = true; pAfterNode = null; } TreeListNode found = FindNextRaw8Bytes(node.Nodes, ref pAfterNode, pValue); if (!foundStart) foundStart = pAfterNode == null; if (found != null) return found; } return null; }
private TreeListNode FindNextUnsigned(TreeListNodeCollection pNodes, ref TreeListNode pAfterNode, ulong pValue) { bool foundStart = pAfterNode == null; foreach (TreeListNode node in pNodes) { if (foundStart && node.Tag != null) { if (node.Tag is FieldNodeTag) { RiftPacketField field = (node.Tag as FieldNodeTag).Field; if (field.Type == ERiftPacketFieldType.Unsigned7BitEncoded && (ulong)field.Value.Long == pValue) return node; } else if (node.Tag is RiftPacketFieldValue) { RiftPacketFieldValue value = node.Tag as RiftPacketFieldValue; if (value.Type == ERiftPacketFieldType.Unsigned7BitEncoded && (ulong)value.Long == pValue) return node; } } if (!foundStart && node == pAfterNode) { foundStart = true; pAfterNode = null; } TreeListNode found = FindNextUnsigned(node.Nodes, ref pAfterNode, pValue); if (!foundStart) foundStart = pAfterNode == null; if (found != null) return found; } return null; }
private TreeListNode FindNextBoolean(TreeListNodeCollection pNodes, ref TreeListNode pAfterNode, bool pValue) { bool foundStart = pAfterNode == null; foreach (TreeListNode node in pNodes) { if (foundStart && node.Tag != null) { if (node.Tag is FieldNodeTag) { RiftPacketField field = (node.Tag as FieldNodeTag).Field; if (field.Type == (pValue ? ERiftPacketFieldType.True : ERiftPacketFieldType.False)) return node; } else if (node.Tag is RiftPacketFieldValue) { RiftPacketFieldValue value = node.Tag as RiftPacketFieldValue; if (value.Type == (pValue ? ERiftPacketFieldType.True : ERiftPacketFieldType.False)) return node; } } if (!foundStart && node == pAfterNode) { foundStart = true; pAfterNode = null; } TreeListNode found = FindNextBoolean(node.Nodes, ref pAfterNode, pValue); if (!foundStart) foundStart = pAfterNode == null; if (found != null) return found; } return null; }
private TreeListNode FindNextPacket(TreeListNodeCollection pNodes, ref TreeListNode pAfterNode, bool pOutbound, int pOpcode) { bool foundStart = pAfterNode == null; foreach (TreeListNode node in pNodes) { if (foundStart && node.Tag != null && node.Tag is RiftPacket) { RiftPacket packet = node.Tag as RiftPacket; if (packet.Outbound == pOutbound && packet.Opcode == pOpcode) return node; } if (!foundStart && node == pAfterNode) { foundStart = true; pAfterNode = null; } TreeListNode found = FindNextPacket(node.Nodes, ref pAfterNode, pOutbound, pOpcode); if (!foundStart) foundStart = pAfterNode == null; if (found != null) return found; } return null; }
private void UnfocusNodes(TreeListNodeCollection nodecol) { for (int i = 0; i < nodecol.Count; i++) { UnfocusNodes(nodecol[i].Nodes); nodecol[i].Focused = false; } }
private void AutoSetColWidth(TreeListNodeCollection nodes, ref int mwid, ref int twid, int i) { for (int j = 0; j < nodes.Count; j++) { if (i > 0) twid = (Nodes[j].SubItems[i - 1] == null) ? 0 : GetStringWidth(nodes[j].SubItems[i - 1].Text); // twid = GetStringWidth(nodes[j].SubItems[i-1].Text); else twid = GetStringWidth(nodes[j].Text); twid += 5; if (twid > mwid) mwid = twid; if (nodes[j].Nodes.Count > 0) { AutoSetColWidth(nodes[j].Nodes, ref mwid, ref twid, i); } } }
public TreeListNode() { subitems = new ContainerSubListViewItemCollection(); subitems.ItemsChanged += new ItemsChangedEventHandler(OnSubItemsChanged); nodes = new TreeListNodeCollection(); nodes.Owner = this; nodes.MouseDown += new MouseEventHandler(OnSubNodeMouseDown); }
public TreeListView() : base() { virtualParent = new TreeListNode(); virtualParent.m_bIsRoot = true; // BMS 2003-05-27 - so that we know which parent is the root as this // is special. For example, nodes are always visible this.SelectedItemChanged = null; //this.SelectedIndexChanged = null; nodes = virtualParent.Nodes; nodes.Owner = virtualParent; nodes.MouseDown += new MouseEventHandler(OnSubControlMouseDown); nodes.NodesChanged += new EventHandler(OnNodesChanged); // selectedNodes = new SelectedTreeListNodeCollection(); nodeRowRects = new ListDictionary(); pmRects = new ListDictionary(); // Use reflection to load the // embedded bitmaps for the // styles plus and minus icons Assembly myAssembly = Assembly.GetAssembly(Type.GetType("Lyquidity.Controls.ExtendedListViews.TreeListView")); Stream bitmapStream1 = myAssembly.GetManifestResourceStream("RiftShark.ExtendedListViews.Resources.tv_minus.bmp"); bmpMinus = new Bitmap(bitmapStream1); Stream bitmapStream2 = myAssembly.GetManifestResourceStream("RiftShark.ExtendedListViews.Resources.tv_plus.bmp"); bmpPlus = new Bitmap(bitmapStream2); }
public TreeListNode() { this.BeforeExpand = null; this.AfterCollapse = null; subitems = new ContainerSubListViewItemCollection(); subitems.ItemsChanged += new ItemsChangedEventHandler(OnSubItemsChanged); nodes = new TreeListNodeCollection(); nodes.Owner = this; nodes.MouseDown += new MouseEventHandler(OnSubNodeMouseDown); }