mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 06:29:29 +02:00
lcl: TCoolBar: less autosize updates
git-svn-id: trunk@40501 -
This commit is contained in:
parent
efc032e6cc
commit
76852a3c06
@ -2279,6 +2279,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure BeginUpdate; override;
|
||||||
|
procedure EndUpdate; override;
|
||||||
public
|
public
|
||||||
property Align read GetAlign write SetAlign default alTop;
|
property Align read GetAlign write SetAlign default alTop;
|
||||||
property BandBorderStyle: TBorderStyle read FBandBorderStyle write FBandBorderStyle default bsSingle;
|
property BandBorderStyle: TBorderStyle read FBandBorderStyle write FBandBorderStyle default bsSingle;
|
||||||
|
@ -187,6 +187,8 @@ end;
|
|||||||
procedure TCoolBand.UpdControl(aLabelWidth: integer);
|
procedure TCoolBand.UpdControl(aLabelWidth: integer);
|
||||||
begin
|
begin
|
||||||
if FCoolBar = Nil then Exit;
|
if FCoolBar = Nil then Exit;
|
||||||
|
FCoolBar.DisableAlign;
|
||||||
|
try
|
||||||
Inc(FCoolBar.FUpdateCount);
|
Inc(FCoolBar.FUpdateCount);
|
||||||
if Assigned(FTextLabel) then
|
if Assigned(FTextLabel) then
|
||||||
begin
|
begin
|
||||||
@ -204,7 +206,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
// Calculate left positions and anchoring for text label and control
|
// Calculate left positions and anchoring for text label and control
|
||||||
FControl.Align := alNone; // alCustom does not work here
|
FControl.Align := alNone; // alCustom does not work here
|
||||||
FControl.Parent := FCoolBar;
|
|
||||||
FControl.FreeNotification(FCoolBar);
|
FControl.FreeNotification(FCoolBar);
|
||||||
FControl.Top := FTop;
|
FControl.Top := FTop;
|
||||||
if Assigned(FTextLabel) and FCoolBar.ShowText then
|
if Assigned(FTextLabel) and FCoolBar.ShowText then
|
||||||
@ -230,9 +231,13 @@ begin
|
|||||||
// Make sure other Anchors a Nil
|
// Make sure other Anchors a Nil
|
||||||
FControl.AnchorSide[akBottom].Control := Nil;
|
FControl.AnchorSide[akBottom].Control := Nil;
|
||||||
FControl.AnchorSide[akTop].Control := Nil;
|
FControl.AnchorSide[akTop].Control := Nil;
|
||||||
|
FControl.Parent := FCoolBar;
|
||||||
SetControlWidth;
|
SetControlWidth;
|
||||||
end;
|
end;
|
||||||
Dec(FCoolBar.FUpdateCount);
|
Dec(FCoolBar.FUpdateCount);
|
||||||
|
finally
|
||||||
|
FCoolBar.EnableAlign;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCoolBand.SetControl(aValue: TControl);
|
procedure TCoolBand.SetControl(aValue: TControl);
|
||||||
@ -241,6 +246,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if FControl = aValue then Exit;
|
if FControl = aValue then Exit;
|
||||||
FCoolBar.BeginUpdate;
|
FCoolBar.BeginUpdate;
|
||||||
|
try
|
||||||
if Assigned(aValue) then begin
|
if Assigned(aValue) then begin
|
||||||
Band := TCoolBands(Collection).FindBand(aValue);
|
Band := TCoolBands(Collection).FindBand(aValue);
|
||||||
if Assigned(Band) and (Band <> Self) then begin
|
if Assigned(Band) and (Band <> Self) then begin
|
||||||
@ -250,8 +256,10 @@ begin
|
|||||||
aValue.Parent := Nil;
|
aValue.Parent := Nil;
|
||||||
end;
|
end;
|
||||||
FControl := aValue;
|
FControl := aValue;
|
||||||
FCoolBar.EndUpdate;
|
|
||||||
Changed(True);
|
Changed(True);
|
||||||
|
finally
|
||||||
|
FCoolBar.EndUpdate;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCoolBand.SetParentColor(aValue: Boolean);
|
procedure TCoolBand.SetParentColor(aValue: Boolean);
|
||||||
@ -486,6 +494,18 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCoolBar.BeginUpdate;
|
||||||
|
begin
|
||||||
|
DisableAlign;
|
||||||
|
inherited BeginUpdate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCoolBar.EndUpdate;
|
||||||
|
begin
|
||||||
|
inherited EndUpdate;
|
||||||
|
EnableAlign;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomCoolBar.GrabLeft: integer;
|
function TCustomCoolBar.GrabLeft: integer;
|
||||||
begin
|
begin
|
||||||
Result := 2;
|
Result := 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user