mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-28 21:38:35 +02:00
LCL: ChildSizing, fix calculating MaxWidth/Heigh for cell. If any chell in the Column(or Row in case of Height) has a Constraint it will apply (even if other are not constraint). If several have MaxWidth, the smallest MaxWidth applies.
This commit is contained in:
parent
defe854704
commit
1f35f2f89b
@ -1641,13 +1641,10 @@ var
|
|||||||
CurChild: TAutoSizeBox;
|
CurChild: TAutoSizeBox;
|
||||||
CurBorder: integer;
|
CurBorder: integer;
|
||||||
LastChild: TAutoSizeBox;
|
LastChild: TAutoSizeBox;
|
||||||
HasChildWithoutMax: array [TAutoSizeBoxOrientation] of Boolean;
|
|
||||||
begin
|
begin
|
||||||
if DoInit then InitSums;
|
if DoInit then InitSums;
|
||||||
Orthogonal:=SizeBoxOrthogonal[Orientation];
|
Orthogonal:=SizeBoxOrthogonal[Orientation];
|
||||||
if ChildCount[Orientation]>0 then begin
|
if ChildCount[Orientation]>0 then begin
|
||||||
HasChildWithoutMax[asboHorizontal] := False;
|
|
||||||
HasChildWithoutMax[asboVertical] := False;
|
|
||||||
for i:=0 to ChildCount[Orientation]-1 do begin
|
for i:=0 to ChildCount[Orientation]-1 do begin
|
||||||
CurChild:=Children[Orientation][i];
|
CurChild:=Children[Orientation][i];
|
||||||
|
|
||||||
@ -1662,29 +1659,18 @@ begin
|
|||||||
inc(MinimumSize[Orientation],CurBorder);
|
inc(MinimumSize[Orientation],CurBorder);
|
||||||
inc(PreferredSize[Orientation],CurBorder);
|
inc(PreferredSize[Orientation],CurBorder);
|
||||||
// add item size in Orientation
|
// add item size in Orientation
|
||||||
if not HasChildWithoutMax[Orientation] then begin
|
if CurChild.MaximumSize[Orientation]>0 then
|
||||||
if CurChild.MaximumSize[Orientation]>0 then begin
|
inc(MaximumSize[Orientation],CurChild.MaximumSize[Orientation]);
|
||||||
inc(MaximumSize[Orientation],CurChild.MaximumSize[Orientation]);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
MaximumSize[Orientation]:=0;
|
|
||||||
HasChildWithoutMax[Orientation] := True;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
inc(MinimumSize[Orientation],CurChild.MinimumSize[Orientation]);
|
inc(MinimumSize[Orientation],CurChild.MinimumSize[Orientation]);
|
||||||
inc(PreferredSize[Orientation],CurChild.PreferredSize[Orientation]);
|
inc(PreferredSize[Orientation],CurChild.PreferredSize[Orientation]);
|
||||||
|
|
||||||
// maximize in Orthogonal
|
// maximize in Orthogonal
|
||||||
if not HasChildWithoutMax[Orthogonal] then begin
|
if MaximumSize[Orthogonal] = 0 then
|
||||||
if CurChild.MaximumSize[Orthogonal]>0 then begin
|
MaximumSize[Orthogonal] := CurChild.MaximumSize[Orthogonal]
|
||||||
MaximumSize[Orthogonal]:=Max(MaximumSize[Orthogonal],
|
else
|
||||||
CurChild.MaximumSize[Orthogonal]);
|
if CurChild.MaximumSize[Orthogonal] > 0 then
|
||||||
end
|
MaximumSize[Orthogonal]:=Min(MaximumSize[Orthogonal],
|
||||||
else begin
|
CurChild.MaximumSize[Orthogonal]);
|
||||||
MaximumSize[Orthogonal]:=0;
|
|
||||||
HasChildWithoutMax[Orthogonal] := True;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
MinimumSize[Orthogonal]:=Max(MinimumSize[Orthogonal],
|
MinimumSize[Orthogonal]:=Max(MinimumSize[Orthogonal],
|
||||||
CurChild.MinimumSize[Orthogonal]);
|
CurChild.MinimumSize[Orthogonal]);
|
||||||
PreferredSize[Orthogonal]:=Max(PreferredSize[Orthogonal],
|
PreferredSize[Orthogonal]:=Max(PreferredSize[Orthogonal],
|
||||||
|
Loading…
Reference in New Issue
Block a user