delphi: what the purpose of the icontent?

  

What exactly the purpose of the icontent ? i know it’s used in TContent that is the container of all the controls of a scrollbox (for exemple) but i can’t really understand why use it ? whats it’s purpose ? when to use it and to not use it ?

i see these function in the delphi source that use icontent but don’t understand what it’s will change for the scrollbox (for exemple)

function TControl.GetAbsoluteClipRect: TRectF;
var
R: TRectF;
LControl: TControl;
LContent: IContent;
begin
Result := TRectF.Empty;
R := AbsoluteRect;
if (Root = nil) or not (Root.GetObject is TCommonCustomForm and IntersectRect(R, R,
TCommonCustomForm(Root.GetObject).ClientRect)) then
begin
LControl := ParentControl;
while LControl <> nil do
begin
if LControl.ClipChildren and not (LControl.GetInterface(IContent, LContent) or IntersectRect(R, R,
LControl.AbsoluteRect)) then
Exit;
LControl := LControl.ParentControl;
end;
Result := R;
end;
end;

procedure TFmxObject.GetChildren(Proc: TGetChildProc; Root: TComponent);
var
I, J: Integer;
Content: IContent;
begin
inherited;
if Supports(Self, IContent) then
Exit;
if FChildren <> nil then
for I := 0 to FChildren.Count – 1 do
begin
if Supports(FChildren[I], IContent, Content) and (Content.ChildrenCount > 0) then
begin
for J := 0 to Content.ChildrenCount – 1 do
if Content.GetObject.Children[J].Stored then
Proc(Content.GetObject.Children[J]);
end;
if FChildren[I].Stored then
Proc(FChildren[I]);
end;
end;

function TFmxObject.GetParentComponent: TComponent;
var
Content: IContent;
begin
if (FParent <> nil) and Supports(FParent, IContent, Content) then
Result := Content.Parent
else
Result := FParent;
if (Result = nil) and (FRoot <> nil) then
Result := FRoot.GetObject;
end;

Comments are closed.