mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 14:19:22 +02:00
LCL: TTreeView: High-DPI: Make spaces between images DPI-aware.
git-svn-id: trunk@55516 -
This commit is contained in:
parent
ac17c74e67
commit
5d80654b46
@ -3259,6 +3259,7 @@ type
|
|||||||
FExpandSignSize: integer;
|
FExpandSignSize: integer;
|
||||||
FThemeExpandSignSize: integer;
|
FThemeExpandSignSize: integer;
|
||||||
FDefItemHeight: integer;
|
FDefItemHeight: integer;
|
||||||
|
FDefItemSpace: Integer;
|
||||||
FDragImage: TDragImageList;
|
FDragImage: TDragImageList;
|
||||||
FDragNode: TTreeNode;
|
FDragNode: TTreeNode;
|
||||||
FIndent: integer;
|
FIndent: integer;
|
||||||
|
@ -1712,7 +1712,7 @@ begin
|
|||||||
TV := TreeView;
|
TV := TreeView;
|
||||||
if (TV = nil) or (TV.StateImages = nil) then Exit;
|
if (TV = nil) or (TV.StateImages = nil) then Exit;
|
||||||
if (StateIndex < 0) or (StateIndex >= TV.StateImages.Count) then Exit;
|
if (StateIndex < 0) or (StateIndex >= TV.StateImages.Count) then Exit;
|
||||||
Inc(Result, TV.StateImages.Width + 2);
|
Inc(Result, TV.StateImages.Width + TV.FDefItemSpace);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNode.DisplayStateIconLeft: integer;
|
function TTreeNode.DisplayStateIconLeft: integer;
|
||||||
@ -1733,7 +1733,7 @@ begin
|
|||||||
else
|
else
|
||||||
ImgIndex:=ImageIndex;
|
ImgIndex:=ImageIndex;
|
||||||
if (ImgIndex<0) or (ImgIndex>=TV.Images.Count) then Exit;
|
if (ImgIndex<0) or (ImgIndex>=TV.Images.Count) then Exit;
|
||||||
Inc(Result, TV.Images.Width + 2);
|
Inc(Result, TV.Images.Width + TV.FDefItemSpace);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNode.DisplayTextRight: integer;
|
function TTreeNode.DisplayTextRight: integer;
|
||||||
@ -3236,6 +3236,7 @@ begin
|
|||||||
ParentColor := False;
|
ParentColor := False;
|
||||||
// FBackgroundColor := clWindow;
|
// FBackgroundColor := clWindow;
|
||||||
FDefItemHeight := DefaultTreeNodeHeight;
|
FDefItemHeight := DefaultTreeNodeHeight;
|
||||||
|
FDefItemSpace := ScaleY(2, 96);
|
||||||
FExpandSignType := tvestTheme;
|
FExpandSignType := tvestTheme;
|
||||||
FExpandSignSize := -1;
|
FExpandSignSize := -1;
|
||||||
Details := ThemeServices.GetElementDetails(ttGlyphOpened);
|
Details := ThemeServices.GetElementDetails(ttGlyphOpened);
|
||||||
@ -3601,12 +3602,12 @@ var
|
|||||||
begin
|
begin
|
||||||
if (tvoAutoItemHeight in FOptions)
|
if (tvoAutoItemHeight in FOptions)
|
||||||
and HandleAllocated and Canvas.HandleAllocated then begin
|
and HandleAllocated and Canvas.HandleAllocated then begin
|
||||||
NewDefItemHeight:=Canvas.TextHeight(TVAutoHeightString)+2; // +2 for spacing
|
NewDefItemHeight:=Canvas.TextHeight(TVAutoHeightString)+FDefItemSpace;
|
||||||
if NewDefItemHeight<2 then NewDefItemHeight:=2;
|
if NewDefItemHeight<FDefItemSpace then NewDefItemHeight:=FDefItemSpace;
|
||||||
if (Images<>nil) and (Images.Height>NewDefItemHeight) then
|
if (Images<>nil) and (Images.Height+FDefItemSpace>NewDefItemHeight) then
|
||||||
NewDefItemHeight:=Images.Height;
|
NewDefItemHeight:=Images.Height+FDefItemSpace;
|
||||||
if (StateImages<>nil) and (StateImages.Height>NewDefItemHeight) then
|
if (StateImages<>nil) and (StateImages.Height+FDefItemSpace>NewDefItemHeight) then
|
||||||
NewDefItemHeight:=StateImages.Height;
|
NewDefItemHeight:=StateImages.Height+FDefItemSpace;
|
||||||
if Odd(NewDefItemHeight) then Inc(NewDefItemHeight);
|
if Odd(NewDefItemHeight) then Inc(NewDefItemHeight);
|
||||||
if NewDefItemHeight<>FDefItemHeight then begin
|
if NewDefItemHeight<>FDefItemHeight then begin
|
||||||
FDefItemHeight:=NewDefItemHeight;
|
FDefItemHeight:=NewDefItemHeight;
|
||||||
@ -5246,7 +5247,7 @@ begin
|
|||||||
if PaintImages then
|
if PaintImages then
|
||||||
StateImages.Draw(Canvas, x + 1, (NodeRect.Top + NodeRect.Bottom - StateImages.Height) div 2,
|
StateImages.Draw(Canvas, x + 1, (NodeRect.Top + NodeRect.Bottom - StateImages.Height) div 2,
|
||||||
Node.StateIndex, True);
|
Node.StateIndex, True);
|
||||||
Inc(x, StateImages.Width + 2);
|
Inc(x, StateImages.Width + FDefItemSpace);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5288,7 +5289,7 @@ begin
|
|||||||
ImgIndex, Node.FNodeEffect);
|
ImgIndex, Node.FNodeEffect);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Inc(x, Images.Width + 2);
|
Inc(x, Images.Width + FDefItemSpace);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5730,8 +5731,8 @@ begin
|
|||||||
if Images <> nil then begin
|
if Images <> nil then begin
|
||||||
Images.RegisterChanges(FImageChangeLink);
|
Images.RegisterChanges(FImageChangeLink);
|
||||||
Images.FreeNotification(Self);
|
Images.FreeNotification(Self);
|
||||||
if DefaultItemHeight<Images.Height+2 then
|
if DefaultItemHeight<Images.Height+FDefItemSpace then
|
||||||
DefaultItemHeight:=Images.Height+2;
|
DefaultItemHeight:=Images.Height+FDefItemSpace;
|
||||||
end;
|
end;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
@ -5768,8 +5769,8 @@ begin
|
|||||||
if StateImages <> nil then begin
|
if StateImages <> nil then begin
|
||||||
StateImages.RegisterChanges(FStateChangeLink);
|
StateImages.RegisterChanges(FStateChangeLink);
|
||||||
StateImages.FreeNotification(Self);
|
StateImages.FreeNotification(Self);
|
||||||
if DefaultItemHeight<StateImages.Height+2 then
|
if DefaultItemHeight<StateImages.Height+FDefItemSpace then
|
||||||
DefaultItemHeight:=StateImages.Height+2;
|
DefaultItemHeight:=StateImages.Height+FDefItemSpace;
|
||||||
end;
|
end;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user