summaryrefslogtreecommitdiff
path: root/src/gui/fpg_tree.pas
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/fpg_tree.pas')
-rw-r--r--src/gui/fpg_tree.pas40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gui/fpg_tree.pas b/src/gui/fpg_tree.pas
index 351c9050..da3e2ddf 100644
--- a/src/gui/fpg_tree.pas
+++ b/src/gui/fpg_tree.pas
@@ -96,6 +96,7 @@ type
function CountRecursive: integer;
function FindSubNode(AText: string; ARecursive: Boolean): TfpgTreeNode; overload;
function FindSubNode(ATreeNodeFindMethod: TfpgTreeNodeFindMethod): TfpgTreeNode; overload;
+ function FindSubNode(AData: TObject; ARecursive: Boolean): TfpgTreeNode; overload;
function GetMaxDepth: integer;
function GetMaxVisibleDepth: integer;
procedure Append(var aValue: TfpgTreeNode);
@@ -479,6 +480,45 @@ begin
end;
end;
+function TfpgTreeNode.FindSubNode(AData: TObject; ARecursive: Boolean): TfpgTreeNode;
+var
+ h: TfpgTreeNode;
+begin
+ result := nil;
+ if ARecursive then
+ begin
+ h := FirstSubNode;
+ while h <> nil do
+ begin
+ if TObject(h.Data) = AData then
+ begin
+ result := h;
+ Exit; //==>
+ end;
+ if h.count > 0 then
+ begin
+ result := h.FindSubNode(AData, ARecursive);
+ if result <> nil then
+ Exit; //==>
+ end;
+ h := h.next;
+ end; { while }
+ end
+ else
+ begin
+ h := FirstSubNode;
+ while h <> nil do
+ begin
+ if TObject(h.Data) = AData then
+ begin
+ result := h;
+ break;
+ end;
+ h := h.next;
+ end;
+ end; { if/else }
+end;
+
function TfpgTreeNode.AppendText(AText: TfpgString): TfpgTreeNode;
var
h: TfpgTreeNode;