Skip to content

Commit aff960b

Browse files
committed
Some changes from LazVTV
1 parent 15f891d commit aff960b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

Source/VirtualTrees.pas

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6134,6 +6134,8 @@ function TVirtualTreeHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: str
61346134
DoPaintText(Node, Self.Canvas, Column, ttNormal);
61356135
//force the default hint font color
61366136
Canvas.Font.Color := Screen.HintFont.Color;
6137+
if Canvas.Font.Color = clDefault then
6138+
Canvas.Font.Color := clInfoText;
61376139
end;
61386140

61396141
//let THintWindow do the job
@@ -8331,7 +8333,7 @@ procedure TVirtualTreeColumns.DrawButtonText(DC: HDC; Caption: String; Bounds: T
83318333
else
83328334
TextColor := FHeader.Treeview.FColors.HeaderFontColor;
83338335
if TextColor = clDefault then
8334-
TextColor := clBtnText;
8336+
TextColor := FHeader.Treeview.GetDefaultColor(dctFont);
83358337
SetTextColor(DC, ColorToRGB(TextColor));
83368338
DrawText(DC, PChar(Caption), Length(Caption), Bounds, DrawFormat);
83378339
end;
@@ -9521,8 +9523,13 @@ procedure TVirtualTreeColumns.PaintHeader(TargetCanvas: TCanvas; R: TRect; const
95219523
ColImageInfo.Index := GetCheckImage(nil, FCheckType, FCheckState, IsEnabled);
95229524
ColImageInfo.XPos := GlyphPos.X;
95239525
ColImageInfo.YPos := GlyphPos.Y;
9526+
if ColImageInfo.Images <> nil then begin
95249527
w := ColImageInfo.Images.Width;
95259528
h := ColImageInfo.Images.Height;
9529+
end else begin
9530+
w := 0;
9531+
h := 0;
9532+
end;
95269533
PaintCheckImage(TargetCanvas, ColImageInfo, False);
95279534
end;
95289535
end;
@@ -9627,6 +9634,9 @@ procedure TVirtualTreeColumns.PaintHeader(TargetCanvas: TCanvas; R: TRect; const
96279634
// Use shortcuts for the images and the font.
96289635
Images := FHeader.FImages;
96299636
Font := FHeader.FFont;
9637+
if Font.Color = clDefault then
9638+
Font.Color := FHeader.Treeview.GetDefaultColor(dctFont);
9639+
96309640
{$IF LCL_FullVersion >= 2000000}
96319641
if Images <> nil then
96329642
ImagesRes := Images.ResolutionForPPI[FHeader.ImagesWidth, Font.PixelsPerInch, Header.TreeView.GetCanvasScaleFactor];
@@ -14481,7 +14491,7 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
1448114491

1448214492
{$ifdef ThemeSupport}
1448314493
{$ifdef Windows}
14484-
if Theme <> 0 then
14494+
if tsUseThemes in FStates then
1448514495
CloseThemeData(Theme);
1448614496
{$endif}
1448714497
{$endif ThemeSupport}
@@ -22767,7 +22777,7 @@ procedure TBaseVirtualTree.HandleMouseDown(var Message: TLMMouse; var HitInfo: T
2276722777
else // No MultiSelect, hence we can start a drag anywhere in the row.
2276822778
FullRowDrag := toFullRowDrag in FOptions.FMiscOptions;
2276922779

22770-
IsHeightTracking := (Message.Msg = LM_LBUTTONDOWN) and
22780+
IsHeightTracking := (Message.Msg = WM_LBUTTONDOWN) and
2277122781
(hiOnItem in HitInfo.HitPositions) and
2277222782
([hiUpperSplitter, hiLowerSplitter] * HitInfo.HitPositions <> []);
2277322783

@@ -24448,10 +24458,10 @@ procedure TBaseVirtualTree.PaintNodeButton(Canvas: TCanvas; Node: PVirtualNode;
2444824458
IsHot: Boolean;
2444924459
{$ifdef Windows}
2445024460
Theme: HTHEME;
24451-
{$endif}
2445224461
Glyph: Integer;
2445324462
State: Integer;
2445424463
Pos: TRect;
24464+
{$endif}
2445524465

2445624466
begin
2445724467
IsHot := (toHotTrack in FOptions.FPaintOptions) and (FCurrentHotNode = Node) and FHotNodeButtonHit;
@@ -24464,11 +24474,11 @@ procedure TBaseVirtualTree.PaintNodeButton(Canvas: TCanvas; Node: PVirtualNode;
2446424474

2446524475
if tsUseExplorerTheme in FStates then
2446624476
begin
24477+
{$ifdef Windows}
2446724478
Glyph := IfThen(IsHot, TVP_HOTGLYPH, TVP_GLYPH);
2446824479
State := IfThen(vsExpanded in Node.States, GLPS_OPENED, GLPS_CLOSED);
2446924480
Pos := Rect(XPos, R.Top + ButtonY, XPos + FPlusBM.Width, R.Top + ButtonY + FPlusBM.Height);
2447024481

24471-
{$ifdef Windows}
2447224482
Theme := OpenThemeData(Handle, 'TREEVIEW');
2447324483
DrawThemeBackground(Theme, Canvas.Handle, Glyph, State, Pos, nil);
2447424484
CloseThemeData(Theme);
@@ -33635,7 +33645,7 @@ procedure TCustomVirtualStringTree.InitializeTextProperties(var PaintInfo: TVTPa
3363533645
end;
3363633646
end;
3363733647
if Canvas.Font.Color = clDefault then
33638-
Canvas.Font.Color := clWindowText;
33648+
Canvas.Font.Color := GetDefaultColor(dctFont);
3363933649
end;
3364033650
end;
3364133651

@@ -33749,6 +33759,8 @@ procedure TCustomVirtualStringTree.PaintStaticText(const PaintInfo: TVTPaintInfo
3374933759
with PaintInfo do
3375033760
begin
3375133761
Canvas.Font := Font;
33762+
if Font.Color = clDefault then
33763+
Canvas.Font.Color := GetDefaultColor(dctFont);
3375233764
if toFullRowSelect in FOptions.FSelectionOptions then
3375333765
begin
3375433766
if Node = FDropTargetNode then
@@ -33766,6 +33778,8 @@ procedure TCustomVirtualStringTree.PaintStaticText(const PaintInfo: TVTPaintInfo
3376633778
else
3376733779
Canvas.Font.Color := FColors.NodeFontColor;
3376833780
end;
33781+
if Canvas.Font.Color = clDefault then
33782+
Canvas.Font.Color := GetDefaultColor(dctFont);
3376933783
end;
3377033784

3377133785
DrawFormat := DT_NOPREFIX or DT_VCENTER or DT_SINGLELINE;
@@ -34210,6 +34224,7 @@ function TCustomVirtualStringTree.DoShortenString(Canvas: TCanvas; Node: PVirtua
3421034224
Done: Boolean;
3421134225

3421234226
begin
34227+
Result := '';
3421334228
Done := False;
3421434229
if Assigned(FOnShortenString) then
3421534230
FOnShortenString(Self, Canvas, Node, Column, S, Width, Result, Done);

0 commit comments

Comments
 (0)