Skip to content

Commit 23892be

Browse files
committed
Moved TBaseVirtualTree.DoPaintText() up in class hierarchy as it is not platform specific. This fixes compiler warning in demp project MVCDemo.
1 parent fa05c1e commit 23892be

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

Source/VirtualTrees.BaseTree.pas

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ TClipboardFormats = class(TStringList)
319319
TVTGetLineStyleEvent = procedure(Sender: TBaseVirtualTree; var Bits: Pointer) of object;
320320
TVTMeasureItemEvent = procedure(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode;
321321
var NodeHeight: TDimension) of object;
322+
TVTPaintText = procedure(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
323+
TextType: TVSTTextType) of object;
322324

323325
TVTPrepareButtonImagesEvent = procedure(Sender: TBaseVirtualTree; const APlusBM : TBitmap; const APlusHotBM :TBitmap;
324326
const APlusSelectedHotBM :TBitmap; const AMinusBM : TBitmap; const AMinusHotBM : TBitmap;
@@ -681,6 +683,8 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
681683
// determined by the application.
682684
FOnGetUserClipboardFormats: TVTGetUserClipboardFormatsEvent; // gives application/descendants the opportunity to
683685
// add own clipboard formats on the fly
686+
FOnPaintText: TVTPaintText; // triggered before either normal or fixed text is painted to allow
687+
// even finer customization (kind of sub cell painting)
684688
// drag'n drop events
685689
FOnCreateDragManager: TVTCreateDragManagerEvent; // called to allow for app./descendant defined drag managers
686690
FOnCreateDataObject: TVTCreateDataObjectEvent; // called to allow for app./descendant defined data objects
@@ -1039,7 +1043,7 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
10391043
function DoPaintBackground(Canvas: TCanvas; R: TRect): Boolean; virtual;
10401044
procedure DoPaintDropMark(Canvas: TCanvas; Node: PVirtualNode; R: TRect); virtual;
10411045
procedure DoPaintNode(var PaintInfo: TVTPaintInfo); virtual;
1042-
procedure DoPaintText(Node: PVirtualNode; const Canvas: TCanvas; Column: TColumnIndex; TextType: TVSTTextType); virtual; abstract;
1046+
procedure DoPaintText(Node: PVirtualNode; const Canvas: TCanvas; Column: TColumnIndex; TextType: TVSTTextType); virtual;
10431047
procedure DoPopupMenu(Node: PVirtualNode; Column: TColumnIndex; Position: TPoint); virtual;
10441048
procedure DoRemoveFromSelection(Node: PVirtualNode); virtual;
10451049
procedure DoReset(Node: PVirtualNode); virtual;
@@ -1363,6 +1367,7 @@ TBaseVirtualTree = class abstract(TVTBaseAncestor)
13631367
property OnNodeMoved: TVTNodeMovedEvent read FOnNodeMoved write FOnNodeMoved;
13641368
property OnNodeMoving: TVTNodeMovingEvent read FOnNodeMoving write FOnNodeMoving;
13651369
property OnPaintBackground: TVTBackgroundPaintEvent read FOnPaintBackground write FOnPaintBackground;
1370+
property OnPaintText: TVTPaintText read FOnPaintText write FOnPaintText;
13661371
property OnPrepareButtonBitmaps : TVTPrepareButtonImagesEvent read FOnPrepareButtonImages write SetOnPrepareButtonImages;
13671372
property OnRemoveFromSelection: TVTRemoveFromSelectionEvent read FOnRemoveFromSelection write FOnRemoveFromSelection;
13681373
property OnResetNode: TVTChangeEvent read FOnResetNode write FOnResetNode;
@@ -10658,6 +10663,12 @@ procedure TBaseVirtualTree.DoPaintNode(var PaintInfo: TVTPaintInfo);
1065810663
begin
1065910664
end;
1066010665

10666+
procedure TBaseVirtualTree.DoPaintText(Node: PVirtualNode; const Canvas: TCanvas; Column: TColumnIndex; TextType: TVSTTextType);
10667+
begin
10668+
if Assigned(FOnPaintText) then
10669+
FOnPaintText(Self, Canvas, Node, Column, TextType);
10670+
end;
10671+
1066110672
//----------------------------------------------------------------------------------------------------------------------
1066210673

1066310674
procedure TBaseVirtualTree.DoPopupMenu(Node: PVirtualNode; Column: TColumnIndex; Position: TPoint);

Source/VirtualTrees.pas

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ TCustomVirtualStringTree = class;
201201
tstChecked // Only checked nodes are rendered
202202
);
203203

204-
TVTPaintText = procedure(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
205-
TextType: TVSTTextType) of object;
206204
TVSTGetTextEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
207205
TextType: TVSTTextType; var CellText: string) of object;
208206
TVSTGetHintEvent = procedure(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
@@ -250,8 +248,6 @@ TCustomVirtualStringTree = class(TVTAncestor)
250248
FTextHeight: Integer; // true size of the font
251249
FEllipsisWidth: Integer; // width of '...' for the current font
252250

253-
FOnPaintText: TVTPaintText; // triggered before either normal or fixed text is painted to allow
254-
// even finer customization (kind of sub cell painting)
255251
FOnGetText: TVSTGetTextEvent; // used to retrieve the string to be displayed for a specific node
256252
fOnGetCellText: TVSTGetCellTextEvent; // used to retrieve the normal and static text of a tree node
257253
FOnGetHint: TVSTGetHintEvent; // used to retrieve the hint to be displayed for a specific node
@@ -298,8 +294,6 @@ TCustomVirtualStringTree = class(TVTAncestor)
298294
function DoIncrementalSearch(Node: PVirtualNode; const Text: string): Integer; override;
299295
procedure DoNewText(Node: PVirtualNode; Column: TColumnIndex; const Text: string); virtual;
300296
procedure DoPaintNode(var PaintInfo: TVTPaintInfo); override;
301-
procedure DoPaintText(Node: PVirtualNode; const Canvas: TCanvas; Column: TColumnIndex;
302-
TextType: TVSTTextType); override;
303297
function DoShortenString(Canvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; const S: string; Width: TDimension;
304298
EllipsisWidth: TDimension = 0): string; virtual;
305299
procedure DoTextDrawing(var PaintInfo: TVTPaintInfo; const Text: string; CellRect: TRect; DrawFormat: Cardinal); virtual;
@@ -324,7 +318,6 @@ TCustomVirtualStringTree = class(TVTAncestor)
324318
property OnGetText: TVSTGetTextEvent read FOnGetText write FOnGetText;
325319
property OnGetCellText: TVSTGetCellTextEvent read fOnGetCellText write fOnGetCellText;
326320
property OnNewText: TVSTNewTextEvent read FOnNewText write FOnNewText;
327-
property OnPaintText: TVTPaintText read FOnPaintText write FOnPaintText;
328321
property OnShortenString: TVSTShortenStringEvent read FOnShortenString write FOnShortenString;
329322
property OnMeasureTextWidth: TVTMeasureTextEvent read FOnMeasureTextWidth write FOnMeasureTextWidth;
330323
property OnMeasureTextHeight: TVTMeasureTextEvent read FOnMeasureTextHeight write FOnMeasureTextHeight;
@@ -1414,17 +1407,6 @@ procedure TCustomVirtualStringTree.DoPaintNode(var PaintInfo: TVTPaintInfo);
14141407

14151408
//----------------------------------------------------------------------------------------------------------------------
14161409

1417-
1418-
procedure TCustomVirtualStringTree.DoPaintText(Node: PVirtualNode; const Canvas: TCanvas; Column: TColumnIndex;
1419-
TextType: TVSTTextType);
1420-
1421-
begin
1422-
if Assigned(FOnPaintText) then
1423-
FOnPaintText(Self, Canvas, Node, Column, TextType);
1424-
end;
1425-
1426-
//----------------------------------------------------------------------------------------------------------------------
1427-
14281410
function TCustomVirtualStringTree.DoShortenString(Canvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
14291411
const S: string; Width: TDimension; EllipsisWidth: TDimension = 0): string;
14301412

0 commit comments

Comments
 (0)