@@ -1044,7 +1044,6 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
1044
1044
FButtonFillMode: TVTButtonFillMode; // for rectangular tree buttons only: how to fill them
1045
1045
FLineStyle: TVTLineStyle; // style of the tree lines
1046
1046
FLineMode: TVTLineMode; // tree lines or bands etc.
1047
- FDottedBrush: TBrush; // used to paint dotted lines without special pens
1048
1047
FSelectionCurveRadius: Cardinal; // radius for rounded selection rectangles
1049
1048
FSelectionBlendFactor: Byte; // Determines the factor by which the selection rectangle is to be
1050
1049
// faded if enabled.
@@ -1282,7 +1281,7 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
1282
1281
NewRect: TRect): Boolean;
1283
1282
procedure ClearNodeBackground(const PaintInfo: TVTPaintInfo; UseBackground, Floating: Boolean; R: TRect);
1284
1283
function CompareNodePositions(Node1, Node2: PVirtualNode; ConsiderChildrenAbove: Boolean = False): Integer;
1285
- procedure DrawLineImage(const PaintInfo: TVTPaintInfo; X, Y, H, VAlign: TDimension; Style: TVTLineType; Reverse: Boolean);
1284
+ procedure DrawLineImage(const PaintInfo: TVTPaintInfo; X, Y, H, VAlign: TDimension; Style: TVTLineType; Reverse: Boolean; dottedBrush: TBrush );
1286
1285
function FindInPositionCache(Node: PVirtualNode; var CurrentPos: TDimension): PVirtualNode; overload;
1287
1286
function FindInPositionCache(Position: TDimension; var CurrentPos: TDimension): PVirtualNode; overload;
1288
1287
procedure FixupTotalCount(Node: PVirtualNode);
@@ -1603,8 +1602,8 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
1603
1602
procedure DragLeave; virtual;
1604
1603
function DragOver(Source: TObject; KeyState: Integer; DragState: TDragState; Pt: TPoint;
1605
1604
var Effect: Integer): HResult; reintroduce; virtual;
1606
- procedure DrawDottedHLine(const PaintInfo: TVTPaintInfo; Left, Right, Top: TDimension); virtual;
1607
- procedure DrawDottedVLine(const PaintInfo: TVTPaintInfo; Top, Bottom, Left: TDimension; UseSelectedBkColor: Boolean = False); virtual;
1605
+ procedure DrawDottedHLine(const PaintInfo: TVTPaintInfo; Left, Right, Top: TDimension; dottedBrush: TBrush ); virtual;
1606
+ procedure DrawDottedVLine(const PaintInfo: TVTPaintInfo; Top, Bottom, Left: TDimension; dottedBrush: TBrush; UseSelectedBkColor: Boolean = False); virtual;
1608
1607
procedure EndOperation(OperationKind: TVTOperationKind);
1609
1608
procedure EnsureNodeFocused(); virtual;
1610
1609
function FindNodeInSelection(P: PVirtualNode; var Index: Integer; LowBound, HighBound: Integer): Boolean; virtual;
@@ -3238,10 +3237,11 @@ destructor TBaseVirtualTree.Destroy();
3238
3237
DestroyWindowHandle;
3239
3238
3240
3239
// Release FDottedBrush in case WM_NCDESTROY hasn't been triggered.
3241
- if Assigned(FDottedBrush ) then
3240
+ if Assigned(DottedBrushTreeLines ) then
3242
3241
begin
3243
- FDottedBrush.Bitmap.Free();
3244
- FreeAndNil(FDottedBrush);
3242
+ DottedBrushTreeLines.Bitmap.Free();
3243
+ DottedBrushTreeLines.Free;
3244
+ DottedBrushTreeLines:= nil;
3245
3245
end;
3246
3246
3247
3247
FHeader.Free;
@@ -4024,7 +4024,7 @@ function TBaseVirtualTree.CompareNodePositions(Node1, Node2: PVirtualNode; Consi
4024
4024
//----------------------------------------------------------------------------------------------------------------------
4025
4025
4026
4026
procedure TBaseVirtualTree.DrawLineImage(const PaintInfo: TVTPaintInfo; X, Y, H, VAlign: TDimension; Style: TVTLineType;
4027
- Reverse: Boolean);
4027
+ Reverse: Boolean; dottedBrush: TBrush );
4028
4028
4029
4029
// Draws (depending on Style) one of the 5 line types of the tree.
4030
4030
// If Reverse is True then a right-to-left column is being drawn, hence horizontal lines must be mirrored.
@@ -4046,38 +4046,38 @@ procedure TBaseVirtualTree.DrawLineImage(const PaintInfo: TVTPaintInfo; X, Y, H,
4046
4046
case Style of
4047
4047
ltBottomRight:
4048
4048
begin
4049
- DrawDottedVLine(PaintInfo, Y + VAlign, Y + H, X + HalfWidth);
4050
- DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign);
4049
+ DrawDottedVLine(PaintInfo, Y + VAlign, Y + H, X + HalfWidth, dottedBrush );
4050
+ DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign, dottedBrush );
4051
4051
end;
4052
4052
ltTopDown:
4053
- DrawDottedVLine(PaintInfo, Y, Y + H, X + HalfWidth);
4053
+ DrawDottedVLine(PaintInfo, Y, Y + H, X + HalfWidth, dottedBrush );
4054
4054
ltTopDownRight:
4055
4055
begin
4056
- DrawDottedVLine(PaintInfo, Y, Y + H, X + HalfWidth);
4057
- DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign);
4056
+ DrawDottedVLine(PaintInfo, Y, Y + H, X + HalfWidth, dottedBrush );
4057
+ DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign, dottedBrush );
4058
4058
end;
4059
4059
ltRight:
4060
- DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign);
4060
+ DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign, dottedBrush );
4061
4061
ltTopRight:
4062
4062
begin
4063
- DrawDottedVLine(PaintInfo, Y, Y + VAlign, X + HalfWidth);
4064
- DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign);
4063
+ DrawDottedVLine(PaintInfo, Y, Y + VAlign, X + HalfWidth, dottedBrush );
4064
+ DrawDottedHLine(PaintInfo, X + HalfWidth, X + TargetX, Y + VAlign, dottedBrush );
4065
4065
end;
4066
4066
ltLeft: // left can also mean right for RTL context
4067
4067
if Reverse then
4068
- DrawDottedVLine(PaintInfo, Y, Y + H, X + FIndent)
4068
+ DrawDottedVLine(PaintInfo, Y, Y + H, X + FIndent, dottedBrush )
4069
4069
else
4070
- DrawDottedVLine(PaintInfo, Y, Y + H, X);
4070
+ DrawDottedVLine(PaintInfo, Y, Y + H, X, dottedBrush );
4071
4071
ltLeftBottom:
4072
4072
if Reverse then
4073
4073
begin
4074
- DrawDottedVLine(PaintInfo, Y, Y + H, X + FIndent);
4075
- DrawDottedHLine(PaintInfo, X, X + FIndent, Y + H);
4074
+ DrawDottedVLine(PaintInfo, Y, Y + H, X + FIndent, dottedBrush );
4075
+ DrawDottedHLine(PaintInfo, X, X + FIndent, Y + H, dottedBrush );
4076
4076
end
4077
4077
else
4078
4078
begin
4079
- DrawDottedVLine(PaintInfo, Y, Y + H, X);
4080
- DrawDottedHLine(PaintInfo, X, X + FIndent, Y + H);
4079
+ DrawDottedVLine(PaintInfo, Y, Y + H, X, dottedBrush );
4080
+ DrawDottedHLine(PaintInfo, X, X + FIndent, Y + H, dottedBrush );
4081
4081
end;
4082
4082
end;
4083
4083
end;
@@ -5290,7 +5290,7 @@ procedure TBaseVirtualTree.PrepareBitmaps(NeedButtons, NeedLines: Boolean);
5290
5290
DoGetLineStyle(Bits);
5291
5291
BitsLinesCount:= Length(LineBitsDotted);
5292
5292
end;
5293
- FDottedBrush := PrepareDottedBrush(FDottedBrush , Bits, BitsLinesCount);
5293
+ DottedBrushTreeLines := PrepareDottedBrush(DottedBrushTreeLines , Bits, BitsLinesCount);
5294
5294
end;
5295
5295
end;
5296
5296
@@ -8628,6 +8628,7 @@ procedure TBaseVirtualTree.WMNCDestroy(var Message: TWMNCDestroy);
8628
8628
8629
8629
if not (csDesigning in ComponentState) and (toAcceptOLEDrop in FOptions.MiscOptions) then
8630
8630
RevokeDragDrop(Handle);
8631
+
8631
8632
inherited;
8632
8633
end;
8633
8634
@@ -11899,6 +11900,7 @@ procedure TBaseVirtualTree.DoShowScrollBar(Bar: Integer; Show: Boolean);
11899
11900
11900
11901
begin
11901
11902
ShowScrollBar(Bar, Show);
11903
+
11902
11904
if Assigned(FOnShowScrollBar) then
11903
11905
FOnShowScrollBar(Self, Bar, Show);
11904
11906
end;
@@ -12400,6 +12402,7 @@ procedure TBaseVirtualTree.DragLeave;
12400
12402
InvalidateNode(FDropTargetNode);
12401
12403
FDropTargetNode := nil;
12402
12404
end;
12405
+
12403
12406
UpdateWindow();
12404
12407
12405
12408
Effect := 0;
@@ -12606,7 +12609,7 @@ function TBaseVirtualTree.DragOver(Source: TObject; KeyState: Integer; DragState
12606
12609
12607
12610
//----------------------------------------------------------------------------------------------------------------------
12608
12611
12609
- procedure TBaseVirtualTree.DrawDottedHLine(const PaintInfo: TVTPaintInfo; Left, Right, Top: TDimension);
12612
+ procedure TBaseVirtualTree.DrawDottedHLine(const PaintInfo: TVTPaintInfo; Left, Right, Top: TDimension; dottedBrush: TBrush );
12610
12613
12611
12614
// Draws a horizontal line with alternating pixels (this style is not supported for pens under Win9x).
12612
12615
@@ -12618,13 +12621,13 @@ procedure TBaseVirtualTree.DrawDottedHLine(const PaintInfo: TVTPaintInfo; Left,
12618
12621
begin
12619
12622
Brush.Color := FColors.BackGroundColor;
12620
12623
R := Rect(Min(Left, Right), Top, Max(Left, Right) + 1, Top + 1);
12621
- Winapi.Windows.FillRect(Handle, R, FDottedBrush .Handle);
12624
+ Winapi.Windows.FillRect(Handle, R, dottedBrush .Handle);
12622
12625
end;
12623
12626
end;
12624
12627
12625
12628
//----------------------------------------------------------------------------------------------------------------------
12626
12629
12627
- procedure TBaseVirtualTree.DrawDottedVLine(const PaintInfo: TVTPaintInfo; Top, Bottom, Left: TDimension; UseSelectedBkColor: Boolean = False);
12630
+ procedure TBaseVirtualTree.DrawDottedVLine(const PaintInfo: TVTPaintInfo; Top, Bottom, Left: TDimension; dottedBrush: TBrush; UseSelectedBkColor: Boolean = False);
12628
12631
12629
12632
// Draws a horizontal line with alternating pixels (this style is not supported for pens under Win9x).
12630
12633
@@ -12644,7 +12647,7 @@ procedure TBaseVirtualTree.DrawDottedVLine(const PaintInfo: TVTPaintInfo; Top, B
12644
12647
else
12645
12648
Brush.Color := FColors.BackGroundColor;
12646
12649
R := Rect(Left, Min(Top, Bottom), Left + 1, Max(Top, Bottom) + 1);
12647
- Winapi.Windows.FillRect(Handle, R, FDottedBrush .Handle);
12650
+ Winapi.Windows.FillRect(Handle, R, dottedBrush .Handle);
12648
12651
end;
12649
12652
end;
12650
12653
@@ -15305,7 +15308,7 @@ procedure TBaseVirtualTree.PaintTreeLines(const PaintInfo: TVTPaintInfo; IndentS
15305
15308
begin
15306
15309
DoBeforeDrawLineImage(PaintInfo.Node, I + Ord(not (toShowRoot in TreeOptions.PaintOptions)), XPos);
15307
15310
DrawLineImage(PaintInfo, XPos, CellRect.Top, NodeHeight[Node] - 1, VAlign - 1, NewStyles[I],
15308
- BidiMode <> bdLeftToRight);
15311
+ BidiMode <> bdLeftToRight, DottedBrushTreeLines );
15309
15312
Inc(XPos, Offset);
15310
15313
end;
15311
15314
end;
@@ -15315,7 +15318,7 @@ procedure TBaseVirtualTree.PaintTreeLines(const PaintInfo: TVTPaintInfo; IndentS
15315
15318
begin
15316
15319
DoBeforeDrawLineImage(PaintInfo.Node, I + Ord(not (toShowRoot in TreeOptions.PaintOptions)), XPos);
15317
15320
DrawLineImage(PaintInfo, XPos, CellRect.Top, NodeHeight[Node], VAlign - 1, LineImage[I],
15318
- BidiMode <> bdLeftToRight);
15321
+ BidiMode <> bdLeftToRight, DottedBrushTreeLines );
15319
15322
Inc(XPos, Offset);
15320
15323
end;
15321
15324
end;
@@ -21679,15 +21682,15 @@ procedure TBaseVirtualTree.PaintTree(TargetCanvas: TCanvas; Window: TRect; Targe
21679
21682
begin
21680
21683
if BidiMode = bdLeftToRight then
21681
21684
begin
21682
- DrawDottedHLine(PaintInfo, CellRect.Left + PaintInfo.Offsets[ofsCheckBox] - fImagesMargin, CellRect.Right - 1, CellRect.Bottom - 1);
21685
+ DrawDottedHLine(PaintInfo, CellRect.Left + PaintInfo.Offsets[ofsCheckBox] - fImagesMargin, CellRect.Right - 1, CellRect.Bottom - 1, DottedBrushGridLines );
21683
21686
end
21684
21687
else
21685
21688
begin
21686
- DrawDottedHLine(PaintInfo, CellRect.Left, CellRect.Right - IfThen(toFixedIndent in FOptions.PaintOptions, 1, IndentSize) * Integer(FIndent) - 1, CellRect.Bottom - 1);
21689
+ DrawDottedHLine(PaintInfo, CellRect.Left, CellRect.Right - IfThen(toFixedIndent in FOptions.PaintOptions, 1, IndentSize) * Integer(FIndent) - 1, CellRect.Bottom - 1, DottedBrushGridLines );
21687
21690
end;
21688
21691
end
21689
21692
else
21690
- DrawDottedHLine(PaintInfo, CellRect.Left, CellRect.Right, CellRect.Bottom - 1);
21693
+ DrawDottedHLine(PaintInfo, CellRect.Left, CellRect.Right, CellRect.Bottom - 1, DottedBrushGridLines );
21691
21694
21692
21695
Dec(CellRect.Bottom);
21693
21696
Dec(ContentRect.Bottom);
@@ -21721,7 +21724,7 @@ procedure TBaseVirtualTree.PaintTree(TargetCanvas: TCanvas; Window: TRect; Targe
21721
21724
lUseSelectedBkColor := (poDrawSelection in PaintOptions) and (toFullRowSelect in FOptions.SelectionOptions) and
21722
21725
(vsSelected in Node.States) and not (toUseBlendedSelection in FOptions.PaintOptions) and not
21723
21726
(tsUseExplorerTheme in FStates);
21724
- DrawDottedVLine(PaintInfo, CellRect.Top, CellRect.Bottom, CellRect.Right - 1, lUseSelectedBkColor);
21727
+ DrawDottedVLine(PaintInfo, CellRect.Top, CellRect.Bottom, CellRect.Right - 1, DottedBrushGridLines, lUseSelectedBkColor);
21725
21728
end;
21726
21729
21727
21730
Dec(CellRect.Right);
@@ -21917,7 +21920,7 @@ procedure TBaseVirtualTree.PaintTree(TargetCanvas: TCanvas; Window: TRect; Targe
21917
21920
(toShowVertGridLines in FOptions.PaintOptions) and
21918
21921
(not (hoAutoResize in FHeader.Options) or (Cardinal(FirstColumn) < TColumnPosition(Count - 1))) then
21919
21922
begin
21920
- DrawDottedVLine(PaintInfo, R.Top, R.Bottom, R.Right - 1);
21923
+ DrawDottedVLine(PaintInfo, R.Top, R.Bottom, R.Right - 1, DottedBrushGridLines );
21921
21924
Dec(R.Right);
21922
21925
end;
21923
21926
@@ -23328,6 +23331,7 @@ procedure TBaseVirtualTree.ToggleNode(Node: PVirtualNode);
23328
23331
if tsHint in Self.FStates then
23329
23332
Application.CancelHint;
23330
23333
UpdateWindow();
23334
+
23331
23335
// animated expanding
23332
23336
with ToggleData do
23333
23337
begin
0 commit comments