private GetNextNodeDelegate CalculGetNextNode(IncrementalSearchOption aIncr) { if (aIncr == IncrementalSearchOption.VisibleOnly) { if (FCurrentDirection == SearchDirectionOption.Forward) { return(new GetNextNodeDelegate(FOwner.NextVisibleNode)); } else { return(new GetNextNodeDelegate(FOwner.PrevVisibleNode)); } } else { if (FCurrentDirection == SearchDirectionOption.Forward) { return(new GetNextNodeDelegate(FOwner.NextVisibleOrNotNode)); } else { return(new GetNextNodeDelegate(FOwner.PrevVisibleOrNotNode)); } } }
public Node Search(Node aStart, string aText, IncrementalSearchOption aTypeSearch, int aDisplayColumn) { Node Run = aStart; GetNextNodeDelegate GetNextNode; GetNextNode = CalculGetNextNode(aTypeSearch); switch (aTypeSearch) { case IncrementalSearchOption.All: if (Run == null) { Run = (Node)FOwner.FirstVisible(); } break; case IncrementalSearchOption.VisibleOnly: if (Run == null) { Run = (Node)FOwner.FirstVisible(); } else if (!Node.IsFullyVisible(Run)) { Run = Node.NextVisibleNode(Run); } break; } if (Run != null) { Node Stop = Run; do { if (FOwner.DoIncrementalSearch1(Run, aText, aDisplayColumn)) { return(Run); } Run = GetNextNode(Run); }while (Run != null && Run != Stop); } return(null); }