VirtualTreeView: Fix incorrect positioning of node checkboxes if node and state images are turned off

git-svn-id: trunk@59446 -
This commit is contained in:
wp 2018-11-04 13:27:55 +00:00
parent 59e211fd44
commit 198981bc82

View File

@ -3053,6 +3053,7 @@ type
procedure SetCustomCheckImagesWidth(const Value: Integer);
protected
{ multi-resolution imagelist support }
function GetImagesWidth(Images: TCustomImageList): Integer;
property ImagesWidth: Integer read FImagesWidth write SetImagesWidth default 0;
property StateImagesWidth: Integer read FStateImagesWidth write SetStateImagesWidth default 0;
property CustomCheckImagesWidth: Integer read FCustomCheckImagesWidth write SetCustomCheckImagesWidth default 0;
@ -18096,8 +18097,19 @@ procedure TBaseVirtualTree.AdjustImageBorder(Images: TCustomImageList; BidiMode:
// Depending on the width of the image list as well as the given bidi mode R must be adjusted.
var
W, H: Integer;
begin
AdjustImageBorder(GetRealImagesWidth, GetRealImagesHeight, BidiMode, VAlign, R, ImageInfo);
{$IF LCL_FullVersion >= 2000000}
with Images.ResolutionForPPI[GetImagesWidth(Images), Font.PixelsPerInch, GetCanvasScaleFactor] do
{$ELSE}
with Images do
{$IFEND}
begin
W := Width;
H := Height;
end;
AdjustImageBorder(W, H, BidiMode, VAlign, R, ImageInfo);
end;
//----------------------------------------------------------------------------------------------------------------------
@ -21956,6 +21968,22 @@ end;
//----------------------------------------------------------------------------------------------------------------------
{$IF LCL_FullVersion >= 2000000}
function TBaseVirtualTree.GetImagesWidth(Images: TCustomImageList): Integer;
begin
if Images = FImages then
Result := FImagesWidth
else if Images = FStateImages then
Result := FStateImagesWidth
else if Images = FCheckImages then
Result := FCheckImagesWidth
else
Result := 0;
end;
{$IFEND}
//----------------------------------------------------------------------------------------------------------------------
function TBaseVirtualTree.IsEmpty: Boolean;
begin
Result := (Self.ChildCount[nil] = 0);