mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 09:57:41 +01:00
VirtualTreeView: Scaling of state images
git-svn-id: trunk@59407 -
This commit is contained in:
parent
73eac224ba
commit
ea94b0ec43
@ -2133,6 +2133,7 @@ type
|
|||||||
|
|
||||||
{$IF LCL_FullVersion >= 2000000}
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
FImagesWidth: Integer; // needed for high-dpi imagelist support
|
FImagesWidth: Integer; // needed for high-dpi imagelist support
|
||||||
|
FStateImagesWidth: Integer;
|
||||||
FCustomCheckImagesWidth: Integer;
|
FCustomCheckImagesWidth: Integer;
|
||||||
FCheckImagesWidth: Integer;
|
FCheckImagesWidth: Integer;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
@ -3024,6 +3025,8 @@ type
|
|||||||
protected
|
protected
|
||||||
function GetRealImagesWidth: Integer;
|
function GetRealImagesWidth: Integer;
|
||||||
function GetRealImagesHeight: Integer;
|
function GetRealImagesHeight: Integer;
|
||||||
|
function GetRealStateImagesWidth: Integer;
|
||||||
|
function GetRealStateImagesHeight: Integer;
|
||||||
function GetRealCheckImagesWidth: Integer;
|
function GetRealCheckImagesWidth: Integer;
|
||||||
function GetRealCheckImagesHeight: Integer;
|
function GetRealCheckImagesHeight: Integer;
|
||||||
{$IF LCL_FullVersion >= 1080000}
|
{$IF LCL_FullVersion >= 1080000}
|
||||||
@ -3035,10 +3038,12 @@ type
|
|||||||
{$IF LCL_FullVersion >= 2000000}
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
private
|
private
|
||||||
procedure SetImagesWidth(const Value: integer);
|
procedure SetImagesWidth(const Value: integer);
|
||||||
|
procedure SetStateImagesWidth(const Value: Integer);
|
||||||
procedure SetCustomCheckImagesWidth(const Value: Integer);
|
procedure SetCustomCheckImagesWidth(const Value: Integer);
|
||||||
protected
|
protected
|
||||||
{ multi-resolution imagelist support }
|
{ multi-resolution imagelist support }
|
||||||
property ImagesWidth: Integer read FImagesWidth write SetImagesWidth default 0;
|
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;
|
property CustomCheckImagesWidth: Integer read FCustomCheckImagesWidth write SetCustomCheckImagesWidth default 0;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
@ -3653,6 +3658,7 @@ type
|
|||||||
property WantTabs;
|
property WantTabs;
|
||||||
{$IF LCL_FullVersion >= 2000000}
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
property ImagesWidth;
|
property ImagesWidth;
|
||||||
|
property StateImagesWidth;
|
||||||
property CustomCheckImagesWidth;
|
property CustomCheckImagesWidth;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
@ -3919,6 +3925,7 @@ type
|
|||||||
property WantTabs;
|
property WantTabs;
|
||||||
{$IF LCL_FullVersion >= 2000000}
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
property ImagesWidth;
|
property ImagesWidth;
|
||||||
|
property StateImagesWidth;
|
||||||
property CustomCheckImagesWidth;
|
property CustomCheckImagesWidth;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
@ -12465,7 +12472,7 @@ begin
|
|||||||
if ShowImages then
|
if ShowImages then
|
||||||
VAlign := GetNodeImageSize(Node).cy
|
VAlign := GetNodeImageSize(Node).cy
|
||||||
else
|
else
|
||||||
VAlign := FStateImages.Height;
|
VAlign := GetRealStateImagesHeight;
|
||||||
VAlign := MulDiv((Integer(NodeHeight[Node]) - VAlign), Node.Align, 100) + VAlign div 2;
|
VAlign := MulDiv((Integer(NodeHeight[Node]) - VAlign), Node.Align, 100) + VAlign div 2;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -12691,7 +12698,7 @@ begin
|
|||||||
WithImages := Assigned(FImages);
|
WithImages := Assigned(FImages);
|
||||||
WithStateImages := Assigned(FStateImages);
|
WithStateImages := Assigned(FStateImages);
|
||||||
if WithStateImages then
|
if WithStateImages then
|
||||||
StateImageOffset := FStateImages.Width + 2
|
StateImageOffset := GetRealStateImagesWidth + 2
|
||||||
else
|
else
|
||||||
StateImageOffset := 0;
|
StateImageOffset := 0;
|
||||||
if WithCheck then
|
if WithCheck then
|
||||||
@ -12868,7 +12875,7 @@ begin
|
|||||||
WithImages := Assigned(FImages);
|
WithImages := Assigned(FImages);
|
||||||
WithStateImages := Assigned(FStateImages);
|
WithStateImages := Assigned(FStateImages);
|
||||||
if WithStateImages then
|
if WithStateImages then
|
||||||
StateImageOffset := FStateImages.Width + 2
|
StateImageOffset := GetRealStateImagesWidth + 2
|
||||||
else
|
else
|
||||||
StateImageOffset := 0;
|
StateImageOffset := 0;
|
||||||
if WithCheck then
|
if WithCheck then
|
||||||
@ -14984,6 +14991,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBaseVirtualTree.SetStateImagesWidth(const Value: Integer);
|
||||||
|
begin
|
||||||
|
if Value <> FStateImagesWidth then begin
|
||||||
|
FStateImagesWidth := Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBaseVirtualTree.SetCustomCheckImagesWidth(const Value: Integer);
|
procedure TBaseVirtualTree.SetCustomCheckImagesWidth(const Value: Integer);
|
||||||
begin
|
begin
|
||||||
if Value <> FCustomCheckImagesWidth then begin
|
if Value <> FCustomCheckImagesWidth then begin
|
||||||
@ -18018,7 +18033,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ImageInfo.XPos := R.Right - Images.Width;
|
ImageInfo.XPos := R.Right - ImageWidth;
|
||||||
Dec(R.Right, ImageWidth + 2);
|
Dec(R.Right, ImageWidth + 2);
|
||||||
end;
|
end;
|
||||||
ImageInfo.YPos := R.Top + VAlign - ImageHeight div 2;
|
ImageInfo.YPos := R.Top + VAlign - ImageHeight div 2;
|
||||||
@ -18854,7 +18869,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if Assigned(FStateImages) and HasImage(HitInfo.HitNode, ikState, HitInfo.HitColumn) then
|
if Assigned(FStateImages) and HasImage(HitInfo.HitNode, ikState, HitInfo.HitColumn) then
|
||||||
Inc(ImageOffset, FStateImages.Width + 2);
|
Inc(ImageOffset, GetRealStateImagesWidth + 2);
|
||||||
if Offset < ImageOffset then
|
if Offset < ImageOffset then
|
||||||
Include(HitInfo.HitPositions, hiOnStateIcon)
|
Include(HitInfo.HitPositions, hiOnStateIcon)
|
||||||
else
|
else
|
||||||
@ -18991,7 +19006,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if Assigned(FStateImages) and HasImage(HitInfo.HitNode, ikState, HitInfo.HitColumn) then
|
if Assigned(FStateImages) and HasImage(HitInfo.HitNode, ikState, HitInfo.HitColumn) then
|
||||||
Dec(ImageOffset, FStateImages.Width + 2);
|
Dec(ImageOffset, GetRealStateImagesWidth + 2);
|
||||||
if Offset > ImageOffset then
|
if Offset > ImageOffset then
|
||||||
Include(HitInfo.HitPositions, hiOnStateIcon)
|
Include(HitInfo.HitPositions, hiOnStateIcon)
|
||||||
else
|
else
|
||||||
@ -21907,7 +21922,8 @@ begin
|
|||||||
NodeLeft := GetNodeLevel(Node) * FIndent;
|
NodeLeft := GetNodeLevel(Node) * FIndent;
|
||||||
|
|
||||||
if Assigned(FStateImages) then
|
if Assigned(FStateImages) then
|
||||||
Inc(NodeLeft, FStateImages.Width + 2);
|
Inc(NodeLeft, GetRealStateImagesWidth + 2);
|
||||||
|
|
||||||
if Assigned(FImages) then
|
if Assigned(FImages) then
|
||||||
Inc(NodeLeft, GetRealImagesWidth + 2);
|
Inc(NodeLeft, GetRealImagesWidth + 2);
|
||||||
|
|
||||||
@ -21999,6 +22015,28 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function TBaseVirtualTree.GetRealStateImagesWidth: Integer;
|
||||||
|
begin
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
Result := FStateImages.ResolutionForPPI[FStateImagesWidth, Font.PixelsPerInch, GetCanvasScaleFactor].Width;
|
||||||
|
{$ELSE}
|
||||||
|
Result := FStateImages.Width;
|
||||||
|
{$IFEND}
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function TBaseVirtualTree.GetRealStateImagesHeight: Integer;
|
||||||
|
begin
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
Result := FStateImages.ResolutionForPPI[FStateImagesWidth, Font.PixelsPerInch, GetCanvasScaleFactor].Height;
|
||||||
|
{$ELSE}
|
||||||
|
Result := FStateImages.Height;
|
||||||
|
{$IFEND}
|
||||||
|
end;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function TBaseVirtualTree.GetRealCheckImagesWidth: Integer;
|
function TBaseVirtualTree.GetRealCheckImagesWidth: Integer;
|
||||||
begin
|
begin
|
||||||
{$IF LCL_FullVersion >= 2000000}
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
@ -25992,6 +26030,7 @@ begin
|
|||||||
Self.EmptyListMessage := EmptyListMessage;
|
Self.EmptyListMessage := EmptyListMessage;
|
||||||
{$IF LCL_FullVersion >= 2000000}
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
Self.ImagesWidth := ImagesWidth;
|
Self.ImagesWidth := ImagesWidth;
|
||||||
|
Self.StateImagesWidth := StateImagesWidth;
|
||||||
Self.CustomCheckImagesWidth := CustomCheckImagesWidth;
|
Self.CustomCheckImagesWidth := CustomCheckImagesWidth;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
end
|
end
|
||||||
@ -27100,7 +27139,7 @@ begin
|
|||||||
|
|
||||||
// Consider associated images.
|
// Consider associated images.
|
||||||
if Assigned(FStateImages) and HasImage(Node, ikState, Column) then
|
if Assigned(FStateImages) and HasImage(Node, ikState, Column) then
|
||||||
Inc(Offset, FStateImages.Width + 2);
|
Inc(Offset, GetRealStateImagesWidth + 2);
|
||||||
if Assigned(FImages) and HasImage(Node, ikNormal, Column) then
|
if Assigned(FImages) and HasImage(Node, ikNormal, Column) then
|
||||||
Inc(Offset, GetNodeImageSize(Node).cx + 2);
|
Inc(Offset, GetNodeImageSize(Node).cx + 2);
|
||||||
|
|
||||||
@ -27967,7 +28006,7 @@ begin
|
|||||||
|
|
||||||
WithStateImages := Assigned(FStateImages);
|
WithStateImages := Assigned(FStateImages);
|
||||||
if WithStateImages then
|
if WithStateImages then
|
||||||
StateImageOffset := FStateImages.Width + 2
|
StateImageOffset := GetRealStateImagesWidth + 2
|
||||||
else
|
else
|
||||||
StateImageOffset := 0;
|
StateImageOffset := 0;
|
||||||
|
|
||||||
@ -30655,7 +30694,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
GetImageIndex(PaintInfo, ikState, iiState, FStateImages);
|
GetImageIndex(PaintInfo, ikState, iiState, FStateImages);
|
||||||
if ImageInfo[iiState].Index > -1 then
|
if ImageInfo[iiState].Index > -1 then
|
||||||
AdjustImageBorder(FStateImages.Width, FStateImages.Height, BidiMode, VAlign, ContentRect, ImageInfo[iiState]);
|
AdjustImageBorder(GetRealStateImagesWidth, GetRealStateImagesHeight, BidiMode, VAlign, ContentRect, ImageInfo[iiState]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ImageInfo[iiState].Index := -1;
|
ImageInfo[iiState].Index := -1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user