lcl: fix TButtonPanel align problems when no ShowBevel = False

git-svn-id: trunk@28335 -
This commit is contained in:
paul 2010-11-19 04:27:09 +00:00
parent 2c0fe507c3
commit ad105bad42

View File

@ -553,46 +553,57 @@ end;
procedure TCustomButtonPanel.CustomAlignPosition(AControl: TControl;
var ANewLeft, ANewTop, ANewWidth, ANewHeight: Integer; var AlignRect: TRect;
AlignInfo: TAlignInfo);
var
BevelSpacing: TSpacingSize;
begin
//debugln(['TCustomButtonPanel.CustomAlignPosition ',DbgSName(Self),' AControl=',DbgSName(AControl),' AlignRect=',dbgs(AlignRect),' New=',ANewLeft,',',ANewTop,',',ANewWidth,'x',ANewHeight]);
inherited CustomAlignPosition(AControl, ANewLeft, ANewTop, ANewWidth,
ANewHeight, AlignRect, AlignInfo);
if AControl=FButtons[pbHelp] then begin
if Assigned(FBevel) and FBevel.IsControlVisible then
BevelSpacing := Spacing
else
BevelSpacing := 0;
if AControl=FButtons[pbHelp] then
begin
if Align in [alLeft,alRight] then
begin
// put at top
ANewLeft:=AlignRect.Left;
ANewTop:=AlignRect.Top+Spacing;
ANewWidth:=AControl.Constraints.MinMaxWidth(AlignRect.Right-ANewLeft-Spacing);
ANewWidth:=AControl.Constraints.MinMaxWidth(AlignRect.Right-ANewLeft-BevelSpacing);
if Align=alRight then
inc(ANewLeft,Spacing);
inc(ANewLeft,BevelSpacing);
ANewTop:=AlignRect.Top+Spacing;
AlignRect.Top:=Min(AlignRect.Bottom,ANewTop+ANewHeight);
end else begin
end else
begin
// put at left
ANewLeft:=AlignRect.Left+Spacing;
ANewTop:=AlignRect.Top;
ANewHeight:=AControl.Constraints.MinMaxHeight(AlignRect.Bottom-ANewTop-Spacing);
ANewHeight:=AControl.Constraints.MinMaxHeight(AlignRect.Bottom-ANewTop-BevelSpacing);
if Align=alBottom then
inc(ANewTop,Spacing);
inc(ANewTop,BevelSpacing);
ANewLeft:=AlignRect.Left+Spacing;
AlignRect.Left:=Min(AlignRect.Right,ANewLeft+ANewWidth);
end;
end else begin
end else
begin
if Align in [alLeft,alRight] then
begin
// put at bottom
ANewLeft:=AlignRect.Left;
ANewWidth:=AControl.Constraints.MinMaxWidth(AlignRect.Right-ANewLeft-Spacing);
ANewWidth:=AControl.Constraints.MinMaxWidth(AlignRect.Right-ANewLeft-BevelSpacing);
if Align=alRight then
inc(ANewLeft,Spacing);
inc(ANewLeft,BevelSpacing);
ANewTop:=AlignRect.Bottom-ANewHeight-Spacing;
AlignRect.Bottom:=Max(AlignRect.Top,ANewTop);
end else begin
end else
begin
// put at right
ANewTop:=AlignRect.Top;
ANewHeight:=AControl.Constraints.MinMaxHeight(AlignRect.Bottom-ANewTop-Spacing);
ANewHeight:=AControl.Constraints.MinMaxHeight(AlignRect.Bottom-ANewTop-BevelSpacing);
if Align=alBottom then
inc(ANewTop,Spacing);
inc(ANewTop,BevelSpacing);
ANewLeft:=AlignRect.Right-ANewWidth-Spacing;
AlignRect.Right:=Max(AlignRect.Left,ANewLeft);
end;