LCL: Made TCustomImageList more extensible. Based on idea from merge request !202.

1. MarkAsChanged method (protected) is added, which sets FChanged to
true.
2. Virtual DoAfterUpdateStarted and DoBeforeUpdateEnded methods
(protected) are added. They are called in first BeginUpdate and last
EndUpdate respectively.
This commit is contained in:
Maxim Ganetsky 2023-06-19 16:11:00 +03:00
parent faf326a95f
commit 79f7f1bbf2
2 changed files with 20 additions and 0 deletions

View File

@ -313,6 +313,9 @@ type
procedure DefineProperties(Filer: TFiler); override;
procedure SetWidthHeight(NewWidth, NewHeight: integer);
procedure ClearOverlays;
procedure MarkAsChanged;
procedure DoAfterUpdateStarted; virtual;
procedure DoBeforeUpdateEnded; virtual;
public
constructor Create(AOwner: TComponent); override;
constructor CreateSize(AWidth, AHeight: Integer);

View File

@ -1532,6 +1532,7 @@ end;
procedure TCustomImageList.BeginUpdate;
begin
inc(FUpdateCount);
if FUpdateCount = 1 then DoAfterUpdateStarted;
end;
{------------------------------------------------------------------------------
@ -1792,6 +1793,7 @@ procedure TCustomImageList.EndUpdate;
begin
if FUpdateCount<=0 then
RaiseGDBException('');
if FUpdateCount = 1 then DoBeforeUpdateEnded;
dec(FUpdateCount);
Change;
end;
@ -2004,6 +2006,21 @@ begin
FHasOverlays := false;
end;
procedure TCustomImageList.MarkAsChanged;
begin
FChanged := true;
end;
procedure TCustomImageList.DoAfterUpdateStarted;
begin
//
end;
procedure TCustomImageList.DoBeforeUpdateEnded;
begin
//
end;
procedure TCustomImageList.CreateDefaultResolution;
begin
if ResolutionCount=0 then