mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-15 12:19:13 +02:00
LCL: refactor TreeView, move GetNodeAtInternalY inside GetNodeAtY
git-svn-id: trunk@35284 -
This commit is contained in:
parent
8cbd938dd7
commit
9283707671
@ -2840,7 +2840,6 @@ type
|
|||||||
function GetMaxLvl: integer;
|
function GetMaxLvl: integer;
|
||||||
function GetMaxScrollLeft: integer;
|
function GetMaxScrollLeft: integer;
|
||||||
function GetMaxScrollTop: integer;
|
function GetMaxScrollTop: integer;
|
||||||
function GetNodeAtInternalY(Y: Integer): TTreeNode;
|
|
||||||
function GetNodeAtY(Y: Integer): TTreeNode;
|
function GetNodeAtY(Y: Integer): TTreeNode;
|
||||||
function GetNodeDrawAreaHeight: integer;
|
function GetNodeDrawAreaHeight: integer;
|
||||||
function GetNodeDrawAreaWidth: integer;
|
function GetNodeDrawAreaWidth: integer;
|
||||||
|
@ -3621,36 +3621,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.GetNodeAtInternalY(Y: Integer): TTreeNode;
|
|
||||||
// search in all expanded nodes for the node at the absolute coordinate Y
|
|
||||||
var
|
|
||||||
i: integer;
|
|
||||||
begin
|
|
||||||
i := IndexOfNodeAtTop(Items.FTopLvlItems, Items.FTopLvlCount, Y);
|
|
||||||
if i >= 0 then
|
|
||||||
begin
|
|
||||||
Result := Items.FTopLvlItems[i];
|
|
||||||
while Result.Visible and Result.Expanded do
|
|
||||||
begin
|
|
||||||
i := IndexOfNodeAtTop(Result.FItems, Result.FCount, Y);
|
|
||||||
if i >= 0 then
|
|
||||||
Result := Result.Items[i]
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCustomTreeView.GetNodeAtY(Y: Integer): TTreeNode;
|
function TCustomTreeView.GetNodeAtY(Y: Integer): TTreeNode;
|
||||||
// search in all expanded nodes for the node at the screen coordinate Y
|
// search in all expanded nodes for the node at the screen coordinate Y
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if (Y >= BorderWidth) and (Y < (ClientHeight - ScrollBarWidth) - BorderWidth) then
|
if (Y >= BorderWidth) and (Y < (ClientHeight - ScrollBarWidth) - BorderWidth) then
|
||||||
begin
|
begin
|
||||||
inc(Y, FScrolledTop - BorderWidth);
|
inc(Y, FScrolledTop - BorderWidth);
|
||||||
Result := GetNodeAtInternalY(Y);
|
i := IndexOfNodeAtTop(Items.FTopLvlItems, Items.FTopLvlCount, Y);
|
||||||
|
if i >= 0 then
|
||||||
|
begin
|
||||||
|
Result := Items.FTopLvlItems[i];
|
||||||
|
while Result.Visible and Result.Expanded do
|
||||||
|
begin
|
||||||
|
i := IndexOfNodeAtTop(Result.FItems, Result.FCount, Y);
|
||||||
|
if i >= 0 then
|
||||||
|
Result := Result.Items[i]
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user