LCL: computing preferred clientrect: fixed to use Child.GetDefaultWidth/Height and fixed GetDefaultWidth/Height to use BaseBounds only if size is fixed

git-svn-id: trunk@26451 -
This commit is contained in:
mattias 2010-07-04 05:13:32 +00:00
parent cfda21de52
commit 70b09d3d69
2 changed files with 9 additions and 5 deletions

View File

@ -4612,13 +4612,15 @@ end;
------------------------------------------------------------------------------}
function TControl.GetDefaultWidth: integer;
begin
if cfBaseBoundsValid in FControlFlags then
if AutoSize or WidthIsAnchored then
Result := GetControlClassDefaultSize.cx
else if cfBaseBoundsValid in FControlFlags then
Result := FBaseBounds.Right - FBaseBounds.Left
else
if cfWidthLoaded in FControlFlags then
Result := FReadBounds.Right - FReadBounds.Left
else
Result := GetControlClassDefaultSize.CX;
Result := GetControlClassDefaultSize.cx;
end;
{------------------------------------------------------------------------------
@ -4629,7 +4631,9 @@ end;
------------------------------------------------------------------------------}
function TControl.GetDefaultHeight: integer;
begin
if cfBaseBoundsValid in FControlFlags then
if AutoSize or HeightIsAnchored then
Result := GetControlClassDefaultSize.cy
else if cfBaseBoundsValid in FControlFlags then
Result := BaseBounds.Bottom - BaseBounds.Top
else
if cfHeightLoaded in FControlFlags then

View File

@ -1038,7 +1038,7 @@ procedure TAutoSizeCtrlData.ComputePreferredClientArea(
or ((CurPreferredWidth=0) and (csAutoSize0x0 in Child.ControlStyle)) then
NewWidth:=CurPreferredWidth
else
NewWidth:=Max(1,Child.GetControlClassDefaultSize.cx);
NewWidth:=Max(1,Child.GetDefaultWidth);
NewWidth:=Child.Constraints.MinMaxWidth(NewWidth);
if UseCurrentHeight then
@ -1047,7 +1047,7 @@ procedure TAutoSizeCtrlData.ComputePreferredClientArea(
or ((CurPreferredHeight=0) and (csAutoSize0x0 in Child.ControlStyle)) then
NewHeight:=CurPreferredHeight
else
NewHeight:=Max(1,Child.GetControlClassDefaultSize.cy);
NewHeight:=Max(1,Child.GetDefaultHeight);
NewHeight:=Child.Constraints.MinMaxHeight(NewHeight);
end else begin
NewWidth:=0;