mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 09:20:48 +02:00
LCL, TCoolbar: Share code from IsRowEnd function.
git-svn-id: trunk@44993 -
This commit is contained in:
parent
5fcf18bf30
commit
6ec7357462
@ -2342,6 +2342,7 @@ type
|
||||
FVertical: Boolean;
|
||||
FOnChange: TNotifyEvent;
|
||||
function GetAlign: TAlign;
|
||||
function RowEndHelper(ALeft, AVisInd: Integer): Boolean;
|
||||
procedure SetBandBorderStyle(AValue: TBorderStyle);
|
||||
procedure SetBands(AValue: TCoolBands);
|
||||
procedure SetBitmap(aValue: TBitmap);
|
||||
|
@ -457,9 +457,7 @@ begin
|
||||
if (FVisiBands[i].Break or Vertical) or aRowEnd then aLeft := cBorderWidth;
|
||||
aHeight := Max(aHeight, FVisiBands[i].CalcPreferredHeight);
|
||||
inc(aLeft, FVisiBands[i].Width);
|
||||
aRowEnd := (i = aCountM1) or ((i < aCountM1)
|
||||
and ((FVisiBands[i+1].Break or Vertical)
|
||||
or ((aLeft+FVisiBands[i+1].Width) > (ClientWidth-2*cBorderWidth))));
|
||||
aRowEnd := (i = aCountM1) or ( (i < aCountM1) and RowEndHelper(ALeft, i) );
|
||||
//Set all Bands in row to uniform height
|
||||
if aRowEnd then begin
|
||||
for y := aStartIndex to i do
|
||||
@ -590,11 +588,15 @@ begin
|
||||
CalculateAndAlign;
|
||||
end;
|
||||
|
||||
function TCustomCoolBar.RowEndHelper(ALeft, AVisInd: Integer): Boolean;
|
||||
begin
|
||||
Result := FVisiBands[AVisInd+1].Break or Vertical
|
||||
or (ALeft+FVisiBands[AVisInd+1].Width > ClientWidth);
|
||||
end;
|
||||
|
||||
function TCustomCoolBar.IsRowEnd(ALeft, AVisibleIndex: Integer): Boolean;
|
||||
begin
|
||||
Result := (AVisibleIndex < (length(FVisiBands)-1))
|
||||
and ((FVisiBands[AVisibleIndex+1].Break or Vertical)
|
||||
or ((ALeft+FVisiBands[AVisibleIndex+1].Width) > ClientWidth));
|
||||
Result := (AVisibleIndex < length(FVisiBands)-1) and RowEndHelper(ALeft, AVisibleIndex);
|
||||
end;
|
||||
|
||||
procedure TCustomCoolBar.InsertControl(AControl: TControl; Index: integer);
|
||||
|
Loading…
Reference in New Issue
Block a user