mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:59:06 +02:00
VirtualTreeView: Scaling of header images
git-svn-id: trunk@59409 -
This commit is contained in:
parent
fca03c2f20
commit
1b89ed81ab
@ -1267,6 +1267,9 @@ type
|
|||||||
FFixedAreaConstraints: TVTFixedAreaConstraints; // Percentages for the fixed area (header, fixed columns).
|
FFixedAreaConstraints: TVTFixedAreaConstraints; // Percentages for the fixed area (header, fixed columns).
|
||||||
FImages: TCustomImageList;
|
FImages: TCustomImageList;
|
||||||
FImageChangeLink: TChangeLink; // connections to the image list to get notified about changes
|
FImageChangeLink: TChangeLink; // connections to the image list to get notified about changes
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
FImagesWidth: Integer;
|
||||||
|
{$IFEND}
|
||||||
FSortColumn: TColumnIndex;
|
FSortColumn: TColumnIndex;
|
||||||
FSortDirection: TSortDirection;
|
FSortDirection: TSortDirection;
|
||||||
FDragImage: TVTDragImage; // drag image management during header drag
|
FDragImage: TVTDragImage; // drag image management during header drag
|
||||||
@ -1285,6 +1288,9 @@ type
|
|||||||
procedure SetFont(const Value: TFont);
|
procedure SetFont(const Value: TFont);
|
||||||
procedure SetHeight(Value: Integer);
|
procedure SetHeight(Value: Integer);
|
||||||
procedure SetImages(const Value: TCustomImageList);
|
procedure SetImages(const Value: TCustomImageList);
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
procedure SetImagesWidth(const Value: Integer);
|
||||||
|
{$IFEND}
|
||||||
procedure SetMainColumn(Value: TColumnIndex);
|
procedure SetMainColumn(Value: TColumnIndex);
|
||||||
procedure SetMaxHeight(Value: Integer);
|
procedure SetMaxHeight(Value: Integer);
|
||||||
procedure SetMinHeight(Value: Integer);
|
procedure SetMinHeight(Value: Integer);
|
||||||
@ -1362,6 +1368,9 @@ type
|
|||||||
property FixedAreaConstraints: TVTFixedAreaConstraints read FFixedAreaConstraints write FFixedAreaConstraints;
|
property FixedAreaConstraints: TVTFixedAreaConstraints read FFixedAreaConstraints write FFixedAreaConstraints;
|
||||||
property Height: Integer read FHeight write SetHeight stored IsHeightStored;
|
property Height: Integer read FHeight write SetHeight stored IsHeightStored;
|
||||||
property Images: TCustomImageList read FImages write SetImages;
|
property Images: TCustomImageList read FImages write SetImages;
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
property ImagesWidth: Integer read FImagesWidth write SetImagesWidth default 0;
|
||||||
|
{$IFEND}
|
||||||
property MainColumn: TColumnIndex read GetMainColumn write SetMainColumn default 0;
|
property MainColumn: TColumnIndex read GetMainColumn write SetMainColumn default 0;
|
||||||
property MaxHeight: Integer read FMaxHeight write SetMaxHeight default 10000;
|
property MaxHeight: Integer read FMaxHeight write SetMaxHeight default 10000;
|
||||||
property MinHeight: Integer read FMinHeight write SetMinHeight default 10;
|
property MinHeight: Integer read FMinHeight write SetMinHeight default 10;
|
||||||
@ -7386,9 +7395,14 @@ begin
|
|||||||
with Owner, Header do
|
with Owner, Header do
|
||||||
begin
|
begin
|
||||||
if UseHeaderGlyph then
|
if UseHeaderGlyph then
|
||||||
if not FCheckBox then
|
if not FCheckBox then begin
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
with FImages.ResolutionForPPI[FImagesWidth, Font.PixelsPerInch, Self.Owner.Header.TreeView.GetCanvasScaleFactor] do
|
||||||
|
HeaderGlyphSize := Point(Width, Height);
|
||||||
|
{$ELSE}
|
||||||
HeaderGlyphSize := Point(FImages.Width, FImages.Height)
|
HeaderGlyphSize := Point(FImages.Width, FImages.Height)
|
||||||
else
|
{$IFEND}
|
||||||
|
end else
|
||||||
with Self.Owner.Header.Treeview do
|
with Self.Owner.Header.Treeview do
|
||||||
begin
|
begin
|
||||||
if Assigned(FCheckImages) then
|
if Assigned(FCheckImages) then
|
||||||
@ -9206,6 +9220,9 @@ var
|
|||||||
PaintInfo: THeaderPaintInfo;
|
PaintInfo: THeaderPaintInfo;
|
||||||
RequestedElements,
|
RequestedElements,
|
||||||
ActualElements: THeaderPaintElements;
|
ActualElements: THeaderPaintElements;
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
ImagesRes: TScaledImageListResolution;
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
//--------------- local functions -------------------------------------------
|
//--------------- local functions -------------------------------------------
|
||||||
|
|
||||||
@ -9410,7 +9427,11 @@ var
|
|||||||
// main glyph
|
// main glyph
|
||||||
FHasImage := False;
|
FHasImage := False;
|
||||||
if Assigned(Images) then
|
if Assigned(Images) then
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
ImageWidth := ImagesRes.Width
|
||||||
|
{$ELSE}
|
||||||
ImageWidth := Images.Width
|
ImageWidth := Images.Width
|
||||||
|
{$IFEND}
|
||||||
else
|
else
|
||||||
ImageWidth := 0;
|
ImageWidth := 0;
|
||||||
|
|
||||||
@ -9420,9 +9441,15 @@ var
|
|||||||
if not FCheckBox then
|
if not FCheckBox then
|
||||||
begin
|
begin
|
||||||
ColImageInfo.Images := Images;
|
ColImageInfo.Images := Images;
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
ImagesRes.Draw(TargetCanvas, GlyphPos.X, GlyphPos.Y, FImageIndex, IsEnabled);
|
||||||
|
w := ImagesRes.Width;
|
||||||
|
h := ImagesRes.Height;
|
||||||
|
{$ELSE}
|
||||||
Images.Draw(TargetCanvas, GlyphPos.X, GlyphPos.Y, FImageIndex, IsEnabled);
|
Images.Draw(TargetCanvas, GlyphPos.X, GlyphPos.Y, FImageIndex, IsEnabled);
|
||||||
w := Images.Width;
|
w := Images.Width;
|
||||||
h := Images.Height;
|
h := Images.Height;
|
||||||
|
{$IFEND}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -9547,6 +9574,10 @@ begin
|
|||||||
// Use shortcuts for the images and the font.
|
// Use shortcuts for the images and the font.
|
||||||
Images := FHeader.FImages;
|
Images := FHeader.FImages;
|
||||||
Font := FHeader.FFont;
|
Font := FHeader.FFont;
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
if Images <> nil then
|
||||||
|
ImagesRes := Images.ResolutionForPPI[FHeader.ImagesWidth, Font.PixelsPerInch, Header.TreeView.GetCanvasScaleFactor];
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
PrepareButtonStyles;
|
PrepareButtonStyles;
|
||||||
|
|
||||||
@ -9979,6 +10010,18 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
procedure TVTHeader.SetImagesWidth(const Value: Integer);
|
||||||
|
begin
|
||||||
|
if Value <> FImagesWidth then begin
|
||||||
|
FImagesWidth := Value;
|
||||||
|
Invalidate(nil);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TVTHeader.SetMainColumn(Value: TColumnIndex);
|
procedure TVTHeader.SetMainColumn(Value: TColumnIndex);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -11329,6 +11372,9 @@ begin
|
|||||||
SortColumn := TVTHeader(Source).SortColumn;
|
SortColumn := TVTHeader(Source).SortColumn;
|
||||||
SortDirection := TVTHeader(Source).SortDirection;
|
SortDirection := TVTHeader(Source).SortDirection;
|
||||||
Style := TVTHeader(Source).Style;
|
Style := TVTHeader(Source).Style;
|
||||||
|
{$IF LCL_FullVersion >= 2000000}
|
||||||
|
ImagesWidth := TVTHeader(Source).ImagesWidth;
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
RescaleHeader;
|
RescaleHeader;
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user